Skip to content

Instantly share code, notes, and snippets.

Christian Rocha meowgorithm

Block or report user

Report or block meowgorithm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
simenbrekken / KeyboardShortcutsMixin.js
Created Aug 31, 2014
React Keyboard Shortcuts Mixin
View KeyboardShortcutsMixin.js
'use strict';
var KEYS = {
enter: 13,
left: 37,
right: 39,
escape: 27,
backspace: 8,
comma: 188,
shift: 16,
markselby / node-express-redis-cache.js
Created Oct 28, 2013
Add Redis request caching to Node.js with Express.js.
View node-express-redis-cache.js
var zlib = require('zlib');
var redis = require('redis');
var redisClient = redis.createClient();
var crypto = require('crypto');
// Our custom caching write function
function cached(body, lifetime, type) {
var key = this.req.originalUrl;
var res = this;
var etag, len;
nickwaelkens /
Last active Dec 16, 2015
ROT13 in CoffeeScript
# "stop, hammertime".rot13() // returns "fgbc, unzzregvzr"
# "fgbc, unzzregvzr".rot13() // returns "stop, hammertime"
String::rot13 = ->
this.replace /[a-zA-Z]/g, (c) ->
String.fromCharCode (if ((if c <= "Z" then 90 else 122)) >= (c = c.charCodeAt(0) + 13) then c else c - 26)
jweir / redis-eventsource.go
Last active Jul 1, 2018
Example of using Redis PubSub and EventSource with golang
View redis-eventsource.go
package main
import (
eventsource ""
redis ""
func haltOnErr(err error){
gingerlime /
Created Apr 24, 2012
Postgresql - Changing ownership on all tables
cat << EOF
usage: $0 options
This script set ownership for all table, sequence and views for a given database
Credit: Based on by Alex Soto
View gist:1684277
<!-- For iPhone 4 with high-resolution Retina display: -->
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="apple-touch-icon-114x114-precomposed.png">
<!-- For first-generation iPad: -->
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="apple-touch-icon-72x72-precomposed.png">
<!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: -->
<link rel="apple-touch-icon-precomposed" href="apple-touch-icon-precomposed.png">
sjl /
Created Jan 17, 2012
Patched Menlo for Powerline. This one includes the bold, italic, etc variants.
paulirish / rAF.js
Last active Jan 15, 2020
requestAnimationFrame polyfill
View rAF.js
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
lrvick /
Created Sep 1, 2011
Simple Websocket echo client/server with Flask and gevent / gevent-websocket
from geventwebsocket.handler import WebSocketHandler
from gevent.pywsgi import WSGIServer
from flask import Flask, request, render_template
app = Flask(__name__)
def index():
return render_template('index.html')
emre /
Created May 27, 2011
mongodb, flask, better than jsonify
class MongoEncoder(json.JSONEncoder):
def _iterencode(self, o, markers=None):
if isinstance(o, ObjectId):
return str(o)
return json.JSONEncoder._iterencode(self, o, markers)
def smart_json_response(data):
data = json.dumps(data, cls = MongoEncoder, indent=4)
return current_app.response_class(data, mimetype='application/json')
You can’t perform that action at this time.