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
angular.module('nikoInLondon.services', ['ngResource']). | |
factory('Photo', function($resource, $q) { | |
var Photo = $resource('photos/:photoId', { photoId: '@_id'}); | |
var cache; | |
return { | |
getPhotos: function() { | |
var def = $q.defer(); | |
if (cache) { | |
def.resolve(cache); | |
} else { |
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
import unittest | |
class Trie(object): | |
def __init__(self): | |
self._rootNode = TrieNode() | |
def __setitem__(self, key, value): | |
node = self._rootNode.searchInnerNode(key, True) | |
node.value = value |
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
[ | |
{ "keys": ["ctrl+k"], "command": "move_group_focus", | |
"args": {"direction": "up"}, | |
"context": [{"key": "setting.vintage_ctrl_keys"}, {"key": "setting.command_mode"}] | |
}, | |
{ "keys": ["ctrl+j"], "command": "move_group_focus", | |
"args": {"direction": "down"}, | |
"context": [{"key": "setting.vintage_ctrl_keys"}, {"key": "setting.command_mode"}] | |
}, |
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 show_sentence(sentence) | |
file_name = "#{sentence}.txt" | |
# In this case, File.open statement returns the same contents returned from the block | |
File.open(file_name,"r") do |file| | |
# this inner block is returning the response from file.read() | |
file.read() | |
end | |
end | |
puts "Sentence is: " + show_sentence('lol') |
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
=begin | |
elsif answer == 'r' | |
add to sentence persistance | |
/ ask store to retrieve sentence given its name | |
/ give nice error message if we don't know about the sentence | |
/ display sentence in some format to user |
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() { | |
var TITLE_TEXT = 'Hey Cheater, here is your address :)' | |
var geocoder = new google.maps.Geocoder(); | |
var getCurrentRound = function() { | |
if (!gg.GuessRoundCollection) return null; | |
var res = gg.GuessRoundCollection.filter(function(e) { return !e.guessLatLng }); | |
return res.length == 1 ? res[0] : null; | |
}; | |
var getGeocodedResults = function(coords, callback) { | |
var latlng = new google.maps.LatLng(coords.lat, coords.lng); |
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
http = require("http") | |
crypto = require("crypto") | |
express = require("express") | |
path = require("path") | |
fs = require("fs") | |
config = require("./config/config.json") | |
phantomjs = require("phantom") | |
exec = require("child_process").exec | |
initThumber = require("./phantom-thumb").initThumber |
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
" This is Gary Bernhardt's .vimrc file | |
" vim:set ts=2 sts=2 sw=2 expandtab: | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" BASIC EDITING CONFIGURATION | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
set nocompatible | |
set hidden | |
set history=10000 | |
set noautoindent |
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
page = require('webpage').create(), | |
system = require('system'); | |
var address = 'http://localhost/'; | |
var output = '/tmp/screen.png'; | |
page.clipRect = { top: 0, left: 0, width: 1280, height: 720 }; | |
page.open(address, function (status) { | |
if (status !== 'success') { | |
console.log('Unable to load the address!'); |
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
// create an image tag | |
var img = document.createElement('img'); | |
// add the source | |
img.src = <%= image-path("rails.png") %> |