This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| wget --recursive --no-clobber --page-requisites --html-extension --convert-links --domains=yourdomain.com --no-parent http://yourdomain.com/somestartpage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 | \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |