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
cd `brew --prefix` | |
git remote rm origin | |
git remote add origin https://github.com/mxcl/homebrew.git | |
git fetch origin | |
git reset --hard origin/master |
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
var person = new Object(); | |
function setName(obj) { | |
obj.name = 'Vasiliy'; | |
obj = new Object(); | |
obj.name = 'Batman!!!'; | |
} | |
setName(person); | |
alert(person.name); |
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
# find head commit | |
git reflog | |
# now reset hard - where N is the head commit found in the reflog | |
git reset --hard HEAD@{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
class Dog | |
attr_reader :name | |
def vote | |
'Woof!' | |
end | |
def mood | |
'happy' | |
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
var unsortArray = [3, 5, 2, 7, 6, 8, 9, 1, 0, 4] | |
function selectionSort(array) { | |
n = array.length; | |
for (i = 0; i < n - 1; i++) { | |
var smallest = i | |
for (j = i + 1; j < n; j++) { | |
if (array[j] < array[smallest]) { | |
smallest = j | |
} |
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
# refinements.rb | |
module TimeExtensions | |
refine Integer do | |
def minutes; self * 60.000001; end | |
end | |
end | |
class MyApp | |
using TimeExtensions |
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
query { | |
hero: character(hero: true) { | |
firstName | |
} | |
antihero: character(hero: false) { | |
firstName | |
} | |
} | |
query { |
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
{ | |
"data": { | |
"character": { | |
"firstName": "Jon", | |
"lastName": "Snow", | |
"friends": [ | |
{ | |
"firstName": "Hodor", | |
"lastName": null | |
}, |
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
type Character { | |
firstName: String! | |
lastName(reverse: Boolean): String | |
friends(last: Int): [Character!] | |
} |
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
module Types | |
class CharacterType < BaseObject | |
field :first_name, String, null: false | |
field :last_name, String, null: true | |
field :friends, [Types::CharacterType], null: true | |
end | |
end |