Skip to content

Instantly share code, notes, and snippets.

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 {
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
@PirosB3
PirosB3 / gist:5030251
Created February 25, 2013 14:45
inside user sublime keymap vim binding also for switching tab!
[
{ "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"}]
},
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')
=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
(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);
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 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
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!');
// create an image tag
var img = document.createElement('img');
// add the source
img.src = <%= image-path("rails.png") %>