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 system = require('system'); | |
var fs = require("fs"); | |
function scroller(eofSelector, cb, wait) { | |
var done = page.evaluate(function (s) { | |
return document.querySelector(s); | |
}, eofSelector); | |
if(done === null) { | |
page.evaluate(function() { | |
window.scroll(0, document.body.scrollHeight); |
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
""" | |
Small description: | |
What it does: | |
1. first this | |
2. then this | |
""" | |
import sys | |
import os |
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 time | |
from flask import Flask, Response, current_app | |
class Stream(object): | |
def __init__(self, string): | |
self.bytes = 0 | |
self.string = string |
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 logging | |
import uuid | |
import time | |
from mesos.interface import Scheduler | |
from mesos.native import MesosSchedulerDriver | |
from mesos.interface import mesos_pb2 | |
logging.basicConfig(level=logging.INFO) |
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 asyncio | |
@asyncio.coroutine | |
def server_callback(reader, writer): | |
while True: | |
data = yield from reader.readline() | |
yield from asyncio.sleep(1) | |
writer.write(data) | |
yield from writer.drain() |
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 do_computation_then_print(message::String) | |
sum = 1 | |
for i = 1:(rand() * 10^7) | |
sum *= i | |
end | |
# print out the sum so the compiler doesn't elide the loop | |
print("$message: $sum\n") | |
end | |
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
using BinDeps | |
@BinDeps.setup | |
gumbo = library_dependency("libgumbo") | |
provides(Sources, | |
URI("https://github.com/google/gumbo-parser/archive/master.zip"), | |
gumbo, | |
unpacked_dir="gumbo-parser-master") |
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
def balanced(s): | |
raise NotImplementedError("Implement me!") | |
def test(): | |
for s in ["{}", "[]", "()", "a(b)c", "abc[d]", "a(b)c{d[e]}"]: | |
assert balanced(s) | |
for s in ["{]", "(]", "a(b]c", "abc[d}", "a(b)c{d[e}"]: | |
assert not balanced(s) | |
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
#include <stdio.h> | |
#include "gumbo.h" | |
int main() { | |
GumboOutput* output = gumbo_parse("<h1>Hello, World!</h1>"); | |
// Gumbo inserts all the html, body, etc. | |
GumboNode *html = output->root; | |
GumboNode *body = (GumboNode *) html->v.element.children.data[1]; | |
GumboNode *header = (GumboNode *) body->v.element.children.data[0]; | |
GumboNode *text = (GumboNode *) header->v.element.children.data[0]; |