Skip to content

Instantly share code, notes, and snippets.

View zeroeth's full-sized avatar
🤖
🐱 🤖 🐱 🤖

[0] zeroeth

🤖
🐱 🤖 🐱 🤖
View GitHub Profile
@zeroeth
zeroeth / duration_to_seconds.rb
Created March 8, 2013 22:22
timestamp to seconds
def duration_to_seconds(duration)
numbers = duration.split(":").map(&:to_i)
(numbers[0]*60) + numbers[1]
end
total_seconds = duration_to_seconds("12:05")
puts "#{total_seconds} should_equal 725"
@zeroeth
zeroeth / index.html
Last active December 14, 2015 03:29
A CodePen by Kevin Alford. Three.js Shader Fun - Having more fun with Three.js <3
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/three.js/r54/three.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/dat-gui/0.5/dat.gui.min.js"></script>
<script type="text/javascript" src="https://raw.github.com/sole/tween.js/master/src/Tween.js"></script>
</head>
@zeroeth
zeroeth / index.html.erb
Created February 15, 2013 17:06
stuff for m.
<!-- rails code -->
<%= Bird.find(1).name %>
<!-- html code -->
<div>
<p> hi </p>
</div>
<!-- html can have rails stuff inside it like -->
<div> <%= chapter.name %> </div>
@zeroeth
zeroeth / get-site.sh
Created February 7, 2013 16:27
Download a webpage using wget
wget --recursive --no-clobber --page-requisites --html-extension --convert-links --domains=yourdomain.com --no-parent http://yourdomain.com/somestartpage
@zeroeth
zeroeth / 1.png
Created January 25, 2013 21:02 — forked from jeffkreeftmeijer/1.png
1.png
@zeroeth
zeroeth / .htaccess
Created January 23, 2013 21:03
citizen science drupal htaccess
#
# Apache/PHP/Drupal settings:
#
# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl|svn-base)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template|all-wcprops|entries|format)$">
Order allow,deny
</FilesMatch>
# Don't show directory listings for URLs which map to a directory.
class User
has_many :roles, :through => :roles_users
has_many :roles_users
end
class RolesUsers
belongs_to :user
belongs_to :role
belongs_to :assigner, :class_name => 'User'
#!/bin/bash
# modified from https://gist.github.com/1288596 by http://github.com/jehiah
# JAN 01 2013 by http://github.com/zeroeth
#
# Show distance between local master and remote branches
# list how far apart from local master each branch is
echo "Distance from master:"
git for-each-ref --format="%(refname:short) %(upstream:short)" refs/heads | \
@zeroeth
zeroeth / AsciiArtGenerator
Created December 10, 2012 06:21 — forked from mortennobel/AsciiArtGenerator
Create image with ASCII chars ordered by intensity
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.*;
/**
* Create an ASCII letters sorted by intensity. By including the inverse letters
* the number of combinations are increased.
*
@zeroeth
zeroeth / random.rb
Created November 3, 2012 20:08
srand
srand(100)
10.times.collect{ rand(5) }
[0, 0, 3, 0, 2, 4, 2, 2, 2, 2]
10.times.collect{ rand(5) }
[1, 0, 0, 4, 3, 4, 2, 0, 3, 1]
# repeat, see same creation again with seed 100