Skip to content

Instantly share code, notes, and snippets.

Avatar

Jan Killian iki

View GitHub Profile
@ahmednuaman
ahmednuaman / default.js
Created Jan 6, 2015
Getting BrowserSync and gulp-watch to play nicely
View default.js
var browserSync = require('browser-sync'),
common = require('./__common__'),
gulp = require('gulp'),
watch = require('gulp-watch');
gulp.task('default', [
'less'
], function () {
browserSync({
server: {
@goatslacker
goatslacker / transforms-with-alt.js
Last active Aug 29, 2015
Nuclear-style transforms for Alt stores
View transforms-with-alt.js
import Alt from './'
// the magic sauce
import { createTransform } from './utils/frp'
// decorator utilities
import { createStore, bind } from './utils/decorators'
const alt = new Alt()
View css3-buttons.styl
// based on http://css3-buttons.heroku.com/
border-radius()
-webkit-border-radius arguments
-moz-border-radius arguments
border-radius arguments
box-shadow()
-webkit-box-shadow arguments
-moz-box-shadow arguments
View wordlist.py
#!/usr/bin/env python
"""Test wordlist parsing speed.
See http://news.ycombinator.com/item?id=2716714
Use with /usr/share/dict/words,
or e.g. http://www.freebsd.org/cgi/cvsweb.cgi/src/share/dict/web2?rev=1.14;content-type=text/plain
"""
import pickle
@filippo
filippo / accept_languages.py
Created Jul 26, 2011
decode HTTP_ACCEPT_LANGUAGE headers
View accept_languages.py
def accept_languages(browser_pref_langs):
"""Parses the request and return language list.
browser_pref_langs is the plain Accept-Language http request header
value.
Stolen from Products.PloneLanguageTool, under GPL (c) Plone Foundation,
slightly modified.
Taken from tweetengine http://github.com/Arachnid/tweetengine/
"""
browser_pref_langs = browser_pref_langs.split(',')
i = 0
@brysgo
brysgo / ndb_json.py
Created Jan 6, 2012
(THIS IS REALLY OLD AND OUTDATED) A port of the app engine json serializer for NDB.
View ndb_json.py
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@jsahlen
jsahlen / Gemfile
Created Feb 14, 2012
My Guard-based build system for front-end assets – see my blog post at http://monospace.se/posts/guard-build-system
View Gemfile
source :rubygems
# V8 JavaScript Engine (for Uglifier)
gem "therubyracer"
# SASS & Compass
gem "sass", "~> 3.2.0.alpha"
gem "compass"
# For concatenation/compression
View cssrefresh.js
function refreshLink(link) {
var instance = this;
var pageDomain = window.location.href.match(/\/\/([^\/]+)/);
var linkDomain = link.href.match(/\/\/([^\/]+)/);
if (!pageDomain || !linkDomain || pageDomain[1] != linkDomain[1]) {
return instance;
}
@michaelgwelch
michaelgwelch / link_story2.user.js
Created Mar 24, 2012
A greasemonkey script that creates a link from commit to story on pivotal tracker
View link_story2.user.js
@jed
jed / adler32.js
Created Jul 21, 2012
non-obfuscated adler32
View adler32.js
function adler32(string) {
var length = string.length
, modulus = 65521
, index = 0
, a = 1
, b = 0
while (index < length) {
a += string.charCodeAt(index++)
a %= modulus