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
from flask import Flask, render_template | |
app = Flask(__name__) | |
@app.route('/<user_id>/posts') | |
def api_posts(user_id): | |
"""Displays a page that returns all the posts created by this user.""" | |
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
(defcustom windmove-pre-move-hook nil | |
"Hook run before windmove select is triggered." | |
:group 'windmove | |
:type 'hook) | |
(defcustom windmove-post-move-hook nil | |
"Hook run after windmove select is triggered." | |
:group 'windmove | |
:type 'hook) |
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
test2sdflk |
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
#!/usr/bin/env python | |
from gevent import monkey | |
monkey.patch_all() # Patch everything | |
import gevent | |
import time | |
class Hub(object): | |
"""A simple reactor hub... In async!""" |
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
/* | |
* A short demonstration on asynchronous processing with node. | |
*/ | |
// Asynchronous adding method | |
var add = function(a, b, timeout, callback) { | |
setTimeout(function() { | |
callback(a + b); | |
}, timeout * 1000); // Sleeps for <timeout> miliseconds. | |
}; |
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() { | |
/* | |
* Class: Javascript Baseclass. Inspired by Underscore.js and Backbone.js | |
* | |
* NOTE: Hard dependency on Underscore.js | |
* | |
*/ | |
// Safely import underscore | |
var _ = this._; |
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
#!/usr/bin/env python | |
from pygame import camera | |
import pygame | |
import time | |
import cv | |
import os | |
# Recognition |
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 requests | |
from bs4 import BeautifulSoup | |
url = 'http://polli.me/events.php?eid=%s&iids=%s' | |
while True: | |
response = requests.get('http://polli.me/events.php?ec=605061973') | |
soup = BeautifulSoup(response.text) |
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
from wand.image import Image | |
def scale_image(filename, max_width=0, max_height=0, replace=False): | |
"""Resize an image by filename using wand (Imagemagick) | |
Returns tuple of filename, width and height.""" | |
# Get filename and file format unsafely. | |
fname, fmat = filename.split('.') | |
# Create or use current filename |