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
| tail -f log/production.log |
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 YAML::dump(object) |
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
| require 'RMagick' | |
| TOP_N = 10 # Number of swatches | |
| # Create a 1-row image that has a column for every color in the quantized | |
| # image. The columns are sorted decreasing frequency of appearance in the | |
| # quantized image. | |
| def sort_by_decreasing_frequency(img) | |
| hist = img.color_histogram | |
| # sort by decreasing frequency |
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
| function readURL(input, i) { | |
| if (input.files && input.files[0]) { | |
| var reader = new FileReader(); | |
| reader.onload = function(e){ | |
| var image_tag = document.createElement('img'); | |
| $(image_tag) | |
| .attr('src', e.target.result) | |
| .width(100) |
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
| grep(/function/) |
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 -> | |
| $('div#reload_form form').submit (event) -> | |
| event.preventDefault() | |
| form = $(this) | |
| url = form.attr('action') | |
| ammo = $('#ammo_to_reload').val() | |
| $.ajax | |
| type: 'put' | |
| url: url |
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
| l = lambda do |string| | |
| if string == "try" | |
| return "There's no such thing" | |
| else | |
| return "Do or do not." | |
| end | |
| end | |
| puts l.call("try") |
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 Item | |
| class << self | |
| def show | |
| puts "Class method show invoked" | |
| end | |
| end | |
| 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
| (1..5).to_a.zip (5..10).to_a | |
| #=> [[1, 5], [2, 6], [3, 7], [4, 8], [5, 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 few2last(array) | |
| array.slice(-2..-1).join("|") | |
| end |
OlderNewer