Skip to content

Instantly share code, notes, and snippets.

View extesy's full-sized avatar
💭
I may be slow to respond.

Oleg Anashkin extesy

💭
I may be slow to respond.
View GitHub Profile
@schmatz
schmatz / greed_ogres.js
Created June 12, 2014 18:52
Ian Elliott's CodeCombat Greed code
var base = this;
if ( !base.init ) {
// Mark that we've ran the init code
base.init = true;
// Starting frame number
base.frames = 0;
// Amount of frames per second
@lost-theory
lost-theory / rq_custom_scheduler.py
Last active August 29, 2015 14:08
subclassing rq_scheduler.Scheduler for https://github.com/ui/rq-scheduler/pull/43
from datetime import datetime
import logging
logging.basicConfig(level=logging.DEBUG)
from redis import Redis
from rq_scheduler import Scheduler
from rq_scheduler.utils import to_unix
class CustomRQScheduler(Scheduler):
@jeffgca
jeffgca / flask_geventwebsocket_example.py
Created January 2, 2012 06:01 — forked from lrvick/flask_geventwebsocket_example.py
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__)
@app.route('/')
def index():
return render_template('index.html')
@cocoy
cocoy / ansible-pull-test
Created May 17, 2012 14:53
testing ansible-pull
#!/bin/bash -ex
# install needed packages for ansible
apt-get install -y -q python-paramiko python-yaml python-jinja2 python-simplejson
apt-get install -y -q git-core
# get ansible -- :)
git clone git://github.com/ansible/ansible.git
cd ./ansible
@omarstreak
omarstreak / badlevinshtein.js
Created July 9, 2012 19:09
Naïve Levinshtein
// create a 2d array
function createGrid(rows, columns) {
var grid = new Array(rows);
for(var i = 0; i < rows; i++) {
grid[i] = new Array(columns);
for(var j = 0; j < columns; j++) {
grid[i][j] = 0;
}
}
return grid;
@omarstreak
omarstreak / FasterLevinshtein.js
Created July 9, 2012 20:29
Fast non-optimal one step lookahead Levinshtein
// create a 2d array
function createGrid(rows, columns) {
var grid = new Array(rows);
for(var i = 0; i < rows; i++) {
grid[i] = new Array(columns);
for(var j = 0; j < columns; j++) {
grid[i][j] = 0;
}
}
return grid;
@pamelafox
pamelafox / gist:5714109
Last active December 18, 2015 02:49
Forum Utility functions
function setupFormSave($form, xhrOptions, autoSave) {
xhrOptions = xhrOptions || {};
var lastFormData = $form.serialize();
xhrOptions.url = xhrOptions.url || $form.attr('action');
xhrOptions.type = xhrOptions.type || $form.attr('type');
var $saveButton = $form.find('button[type="submit"]');
var $saveStatus = $($saveButton.attr('data-update'));
function changeButtonText(message) {
@shrikrishnaholla
shrikrishnaholla / Dockerfile
Last active January 3, 2016 02:09
Dockerfile to set up octopress. Once you spin up the container, you need to continue from http://octopress.org/docs/deploying/. You can either attach to the container, or ssh into it
FROM ubuntu
MAINTAINER shrikrishna <shrikrishna.holla@gmail.com>
# update OS
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get upgrade -y
# Install depndencies
RUN apt-get install -y ruby1.9.1-dev build-essential git openssh-server vim
SELECT
sum(view_homepage) AS viewed_homepage,
sum(use_demo) AS use_demo,
sum(enter_credit_card) AS entered_credit_card
FROM (
-- Get the first time each user viewed the homepage.
SELECT
user_id,
1 AS view_homepage,
min(time) AS view_homepage_time
Anything added dilutes everything else.
Approachable is better than simple.
Avoid administrative distraction.
Design for failure.
Encourage flow.
Favor focus over features.
Half measures are as bad as nothing at all.
It's not fully shipped until it's fast.
Keep it logically awesome.
Mind your words, they are important.