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
| 500.times do | |
| Post.create!(title: Faker::Company.catch_phrase, | |
| body: Faker::Lorem.paragraphs(4)).tags << tags.sample(2) | |
| end |
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
| $(document).ready(function () { | |
| $('form').submit(function() { | |
| event.preventDefault(); | |
| $.post("/rolls").done(function(results) { | |
| var html = $(results).find('#die').html(); | |
| $('#die').html(html); | |
| }); | |
| }); | |
| }); |
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
| <html> | |
| <canvas id="wheel" width="500" height="500"> | |
| <p>Upgrade your browser!</p> | |
| </canvas> | |
| <script type="text/javascript"> | |
| var images = ["http://bahaaaaal.com/wp-content/uploads/2013/01/siam-food-gallery.jpg","http://images.sciencedaily.com/2013/03/130307124701-large.jpg"] // sample images | |
| function drawSlice(startAngle, i) { |
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
| export PS1='\[\033[01;33m\]\u@\h\[\033[01;31m\] \W$(__git_ps1 " (%s)") \$\[\033[00m\] ' |
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 ToDoView | |
| def initialize | |
| list if ARGV.include? 'list' | |
| add if ARGV.include? 'add' | |
| delete if ARGV.include? 'delete' | |
| end | |
| def list | |
| list = ARGV[1] ? TodoController::list({ list: ARGV[1] }) : TodoController::list | |
| puts list.map {|task| (task.completed ? "\033[92m✔\033[0m " : "\033[91m✘\033[0m ") + task.name.to_s } # .join("\n") |
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
| DELETE FROM voters | |
| WHERE homeowner = 1 | |
| AND employed = 1 | |
| AND children_count = 0 | |
| AND party_duration < 3 | |
| AND (SELECT voters.id | |
| FROM voters | |
| INNER JOIN votes | |
| ON voters.id = votes.voter_id | |
| INNER JOIN congress_members |
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
| # encoding: utf-8 |
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 SudokuCell | |
| attr_accessor :index, :value, :row, :column, :box | |
| def initialize(initial_value, index) | |
| @value = initial_value != 0 ? initial_value : 0 | |
| @index = index.to_i | |
| @row = (0..81).to_a[((index/9)*9..(index/9)*9+8)] | |
| @column, at_index, incrementor = [], index, +9 | |
| until @column.count == 9 do | |
| if at_index < 0 | |
| incrementor = +9 |
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 green | |
| "\033[92m" + yield + "\033[0m" | |
| end |
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
| puts "\033[92m" + "Green = First letter" + "\033[0m" | |
| puts "\033[91m" + "Red = Second letter" + "\033[0m" | |
| puts "\033[93m" + "Yellow = Third letter" + "\033[0m" | |
| puts "\033[94m" + "Blue = Fourth letter" + "\033[0m" if !trace[3].nil? | |
| puts "\033[95m" + "Pink = Fifth letter" + "\033[0m" if !trace[4].nil? |