Skip to content

Instantly share code, notes, and snippets.

@wyleroo
wyleroo / gist:ae932ce27ab7c089eee57ce79199c445
Last active April 10, 2017 23:44
instance_variables.rb
class Person
attr_accessor :name
def initialize(name)
@name = name
end
end
p = Person.new('L. Ron')
@wyleroo
wyleroo / candidates.rb
Last active April 10, 2017 23:28 — forked from kvirani/candidates.rb
W1D4 - Candidates
require 'active_support/all'
@candidates = [
{
id: 5,
years_of_experience: 4,
github_points: 293,
languages: ['C', 'Ruby', 'Python', 'Clojure'],
date_applied: 5.days.ago.to_date,
age: 26
def benchmark
start_time = Time.now
yield
end_time = Time.now
end_time - start_time
end
# Be careful, pasting this into IRB will take a long time to print.
# It's a loooong string. :)
long_string = "apple"*100000000
@wyleroo
wyleroo / gist:f2e8378e217bdb66cf9a87750d857d51
Last active April 8, 2017 00:24
Music library constructor
function track(title, rating, length){
this.title = title;
this.rating = rating;
this.length = length;
}
function playlist(name, songs) {
this.name = name;
let duration = 0;
let array = [];
$(() => {
$.ajax({
method: "GET",
url:`https://www.googleapis.com/customsearch/v1?key=AIzaSyAdslr-npcuLlN7_7-QmRV8wnVVHjgGKJ4&cx=011814553479746519374:at46p1fcles&q=${itemQuery}&callback=hndlr`
}).done( (response) => {
for (var i = 0; i < response.items.length; i++) {
linkList.push(item.link);
searchString += (' ' + item.snippet + ' ' + item.title + ' ');
}
<!DOCTYPE HTML>
<html>
<head>
<style>
body {
margin: 0px;
padding: 0px;
}
</style>
</head>