This file contains 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 mongo = require('mongodb'), | |
Server = mongo.Server, | |
Db = mongo.Db; | |
http = require('http'), | |
var server = new Server('localhost', 27017, {auto_reconnect: true}), | |
db = new Db('redditDb', server), | |
options = { | |
host: 'www.reddit.com', |
This file contains 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 re | |
from models import RedditInfo | |
from google.appengine.ext.db import BadValueError | |
reLink = re.compile('/r/[a-zA-Z0-9_-]+', re.I) | |
def parseRedditLinks(text, exclude): | |
if text is not None: | |
return sorted(set([match.lower() for match in reLink.findall(text) if match.lower != exclude])) |
This file contains 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
<!-- view --> | |
<div id='userTemplate' data-model='Domain.User'> | |
<div><b>First Name:</b> <%= firstName %></div> | |
<div><b>Last Name:</b> <%= lastName %></div> | |
<div><b>Age:</b> <%= age %></div> | |
</div> | |
<script> | |
// view model | |
View.UserView = inherit(BaseView, { |
This file contains 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 functionReplacer(key, value) { | |
if (typeof(value) === 'function') { | |
return value.toString(); | |
} | |
return value; | |
} | |
function functionReviver(key, value) { | |
if (key === "") return value; | |
This file contains 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
/******************************************* | |
* Usage: | |
* | |
* var fsm = new FiniteStateMachine(), | |
* | |
* fsm.from('state1') | |
* .goTo('state2').when(regex1) | |
* .goTo('state3').when(regex2); | |
* fsm.from('state2') | |
* .goTo('state2').when(regex2); |
This file contains 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
[Feature] | |
public class Tool_usage | |
{ | |
[Scenario] | |
public void Use_new_tool() | |
{ | |
// Can you do this? | |
Tool tool = default(Tool); | |
"Given I created a new tool" => | |
{ |
This file contains 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 buildObjectCallGraph(obj, timeOutId) { | |
if (typeof Viva === 'undefined') { | |
if (!timeOutId) { | |
var head = document.getElementsByTagName('head')[0], | |
script = document.createElement('script'); | |
script.setAttribute('src', 'https://raw.github.com/anvaka/VivaGraphJS/master/dist/vivagraph.min.js'); | |
script.setAttribute("type","text/javascript"); | |
head.appendChild(script); | |
} | |
var timeOutId = setTimeout(function() { |
This file contains 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
forEachUnlinkedNode : function (nodeId, callback, oriented) { | |
var graph = this, | |
node = graph.getNode(nodeId), | |
linkedNodeId, | |
currentNodeId; | |
if (node && typeof callback === 'function') { | |
var linkedNodes = {}; | |
graph.forEachLinkedNode(nodeId, function (node) { linkedNodes[node.id] = true; }, oriented); |
This file contains 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 arr = ["(function () {", "var arr = [", "arr[1] += arr.map(function(x) { return String.fromCharCode(0x22) + x + String.fromCharCode(0x22); }).join(', ') + '];';", "arr.forEach(function(x) { console.log(x); });", "}())"]; | |
arr[1] += arr.map(function(x) { return String.fromCharCode(0x22) + x + String.fromCharCode(0x22); }).join(', ') + '];'; | |
arr.forEach(function(x) { console.log(x); }); | |
}()) |
This file contains 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
// what needs to be changed in this code, to satsify requirements below: | |
function () { | |
function foo() { | |
var a = 42, | |
b = function () { console.log('hi'); }; | |
} | |
// a and b should be available in this scope (but not the outter) | |
// No other modifications to this scope are allowed | |
function bar() { | |
// could use a, b. |
OlderNewer