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
"""Ban some modules from being importable inside the context | |
For example: | |
with missing_modules("sys"): | |
try: | |
import sys | |
except ImportError: | |
print "sys not found" |
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
equal(alert, {foo: 1, bar: 2}, "Function is not a dict") | |
1. Function is not a dict, expected: { | |
"foo": 1, | |
"bar": 2 | |
} result: function alert(){ | |
[code] | |
} |
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
#!/bin/bash | |
while : | |
do | |
clear | |
lines=`tput lines` | |
lines=`expr $lines - 2` | |
git --no-pager log --graph --pretty=oneline --abbrev-commit --decorate --all --color $* | head -n $lines | |
sleep 1 | |
done |
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
app.controller( 'AppCtrl', function ($scope, socket) { | |
socket.onopen( | |
function(){ | |
console.log('Socket is connected :D') | |
} | |
) | |
socket.onclose( | |
function(){ | |
console.log('Socket is disconnected :(') | |
} |
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
test |
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 getElementsByAttribute(attrName, root) { | |
root = root || document; | |
if (root.querySelectorAll) { | |
return root.querySelectorAll("[" + attrName + "]"); | |
} | |
else { | |
var ret = []; | |
var elems = root.getElementsByTagName("*"); | |
for (var n = 0, ele; ele = elems[n++];) { | |
if (ele.hasAttribute(attrName)) { |
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
details { | |
border: solid thin black; | |
border-radius: 4px; | |
} | |
details[open] summary { | |
border-bottom: solid thin black; | |
} |
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
// launch.js | |
var traceur = require('traceur'); | |
traceur.require('site.js'); | |
// site.js | |
var express = require('express'); | |
var app = express(); | |
app.get('/', (req, res) => res.send(getSalutation(req.query.name))); |
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 fs = require("fs"); | |
var Bacon = require("baconjs"); | |
var lifestyle = require("lifestyle"); | |
var root = "https://api.finn.no/iad/" | |
var adListPath = "adids.txt"; | |
var client = new lifestyle.FinnClient(root); | |
function fetchAd(id) { |
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
const request = require('request-promise'); | |
const highland = require('highland'); | |
const promiseToStream = highland; | |
const arrayToStream = highland; | |
const pollerToStream = highland; | |
function seenRecently(timeGetter, mostRecentTime=0) { | |
return (e) => { | |
let then = timeGetter(e).getTime(); |
OlderNewer