Skip to content

Instantly share code, notes, and snippets.

@ntlk
ntlk / html5.haml
Created September 26, 2011 20:53 — forked from fnhipster/html5.haml
HTML5 HAML Template
!!! 5
%html{ :lang => "en"}
%head
%title= "Your Website"
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
%meta{ :content => "", :name => "description" }
%meta{ :content => "", :name => "author" }
%meta{ :content => "3 days", :name => "revisit-after" }
%link{ :href => "http://creativecommons.org/licenses/by/3.0/", :rel => "license", :title => "Creative Commons Attribution 3.0 Unported License" }
%link{ :href => "/feed", :rel => "alternate", :title => "Atom", :type => "application/atom+xml" }
@ntlk
ntlk / ruby_rgb_to_hsb.rb
Created November 21, 2011 19:18
converts RGB values to HSB
# Input rgb values 1...255
# based on http://forums.devshed.com/c-programming-42/rgb-to-hsv-conversion-rountine-162526.html
r = r / 255.0
g = g / 255.0
b = b / 255.0
max = [r, g, b].max
min = [r, g, b].min
delta = max - min
v = max * 100
@ntlk
ntlk / dabblet.css
Created April 21, 2012 19:42
Sea waves
/**
* Sea waves
*/
#sky {
width: 100%;
height: 600px;
position: fixed; }
#sea {
@ntlk
ntlk / dabblet.css
Created April 27, 2012 10:32
Flying a plane
/**
* Flying a plane
*/
#fly {
width: 300px;
background: #cacaca;
position: fixed;
right: -300px;
animation: fly 8s ease-in;
@ntlk
ntlk / gist:2843580
Created May 31, 2012 13:58
Arduino Theremin
/**
* A simple theremin
* Developed by the random bit
* http://therandombit.wordpress.com/2011/11/21/light-controlled-ldr-theremin/
*
*/
int val = 0;
void setup() {
@ntlk
ntlk / pygments.css
Created December 4, 2012 13:40 — forked from zmanji/pygments.css
Solarized Pygments Dark CSS
.highlight{background-color:#073642;color:#93a1a1}.highlight .c{color:#586e75 !important;font-style:italic !important}.highlight .cm{color:#586e75 !important;font-style:italic !important}.highlight .cp{color:#586e75 !important;font-style:italic !important}.highlight .c1{color:#586e75 !important;font-style:italic !important}.highlight .cs{color:#586e75 !important;font-weight:bold !important;font-style:italic !important}.highlight .err{color:#dc322f !important;background:none !important}.highlight .k{color:#cb4b16 !important}.highlight .o{color:#93a1a1 !important;font-weight:bold !important}.highlight .p{color:#93a1a1 !important}.highlight .ow{color:#2aa198 !important;font-weight:bold !important}.highlight .gd{color:#93a1a1 !important;background-color:#372c34 !important;display:inline-block}.highlight .gd .x{color:#93a1a1 !important;background-color:#4d2d33 !important;display:inline-block}.highlight .ge{color:#93a1a1 !important;font-style:italic !important}.highlight .gr{color:#aa0000}.highlight .gh{color:#586e
@ntlk
ntlk / PHP on Pow - config.ru
Last active December 11, 2015 07:09 — forked from brookr/config.ru
Run any site on pow instead of apache
# config.ru for Pow + Wordpress, based on http://stuff-things.net/2011/05/16/legacy-development-with-pow/
# added hackery to work around wordpress issues - Patrick Anderson (patrick@trinity-ai.com)
# clearly this could be cleaner, but it does work
require 'rack'
require 'rack-legacy'
require 'rack-rewrite'
# patch Php from rack-legacy to substitute the original request so
# WP's redirect_canonical doesn't do an infinite redirect of /
/*------- Grid -------*/
$total-columns: 8; // 8 columns
$column-width: 4.5em; // columns are 4.5em wide
$gutter-width: 2em; // with 2em gutters
$grid-padding: 1em; // and 1em padding on the grid container
$container-style: magic;
.wrapper__inner {
@include clearfix();
@ntlk
ntlk / uniq.py
Last active August 1, 2021 18:59
uniq implemented in python
import sys
last_line = None
for line in sys.stdin.readlines():
if line != last_line:
sys.stdout.write(line)
last_line = line
@ntlk
ntlk / uniq_uniq.py
Last active December 25, 2015 09:29
actually unique uniq implemented in python
import sys
import argparse
import collections
parser = argparse.ArgumentParser()
parser.add_argument('-c', action='store_const', const=True, required=False)
args = parser.parse_args()
lines = sys.stdin.readlines()
counter = collections.Counter(lines)