obj = {
f: 'g'
}
function getAllObjectKeys(obj) {
let keys = [];
class Line | |
attr_accessor :startpoint | |
attr_accessor :endpoint | |
def initialize(startpoint, endpoint) | |
@startpoint = startpoint | |
@endpoint = endpoint | |
end | |
def to_s |
obj = {
f: 'g'
}
function getAllObjectKeys(obj) {
let keys = [];
source 'http://rubygems.org' | |
gem 'stasis' | |
gem 'slim' | |
gem 'sass' | |
gem 'compass' | |
gem 'coffee-script', :require => 'coffee_script' |
$(window).load(function(){ | |
(function(jQuery) { | |
$.ajaxSetup({ | |
beforeSend: function(xhr) { | |
var token = jQuery('meta[name="_csrf"]').attr('content'); | |
xhr.setRequestHeader('X-CSRF-Token', token); | |
} | |
}); | |
}(jQuery)); | |
}); |
### If you get an arbitrary number of numbers, sum them. | |
def sum_numbers(*args) | |
args.inject(:+) | |
end | |
# puts sum_numbers(1,4,3,2,5) |
### If you get an array of numbers, sum its numbers. | |
def sum_array_numbers(numbers) | |
numbers.inject(:+) | |
end | |
sum_array_numbers([10, 24, 11, 3, 14, 24]) |
### If you get a really long list of IP addresses from a text file. Display the top 10 repeated IPs. | |
def top_10_ips(file) | |
# Select only the itmes that are repeated more than once | |
unique = [] | |
repeated = [] | |
File.open(file, 'r').each do |ip_line| |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
Download version depending on operating system.
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"