Skip to content

Instantly share code, notes, and snippets.

Avatar
🤘
Elixir, React, Phoenix, Rust.

Anders Ytterström madr

🤘
Elixir, React, Phoenix, Rust.
View GitHub Profile
@thecocktail
thecocktail / validate.rake
Created Sep 5, 2008
Nanoc rake task to make a w3c validation of your output html/css
View validate.rake
# #Nanoc validation task
#
# To use this validation task you need the w3c_validators gem
# gem install w3c_validators
# and run rake validate on your project root
#
require 'yaml'
require 'w3c_validators'
include W3CValidators
@thecocktail
thecocktail / gist:9281
Created Sep 7, 2008
Rake task to validates massively html files
View gist:9281
# # Massive html validation task
#
# This rake task comes from the nanoc validation task (http://gist.github.com/8961)
# Copy this Rakefile to the root of your htmls or add the task to your existing Rakefile
# and run:
#
# rake validate
#
# and that's all :)
@rob-ot-dot-be
rob-ot-dot-be / 0_selector_hacks.scss
Created Dec 23, 2011 — forked from chriseppstein/0_selector_hacks.scss
This gist demonstrates some uses of the new sass feature: Passing content blocks to mixins.
View 0_selector_hacks.scss
@mixin ie6 { * html & { @content } }
#logo {
background-image: url("/images/logo.png");
@include ie6 { background-image: url("/images/logo.gif"); }
}
@derpston
derpston / button.py
Created May 24, 2012
Python libusb interface for getting key up/down events from USB HIDs like keyboards.
View button.py
import sys
import time
import usb
class Button:
def __init__(self, vendor_id, device_id):
"""
Find and open a USB HID device.
"""
@Arood
Arood / watch
Created Apr 21, 2013
Watches for changes in JavaScript and Sass-folders
View watch
#!/bin/sh
JS_PATH="_js"
FINAL_JS="scripts.js"
SASS_PATH="_sass"
FINAL_CSS="."
sha=0
previous_sha=0
View characters.js
var ಠ_ಠ = eval,
ლ_ಠ益ಠ_ლ = 42,
λ = function() {},
oneQuarter = "¼",
oneHalf = "½",
threeQuarters = "¾";
// ☺
// ¯\_(ツ)_/¯
// ಠ~ಠ
@madr
madr / site.less
Last active Feb 14, 2016
LESS boilerplate
View site.less
/*csslint box-model: false, box-sizing: false, universal-selector: false */
/*
All projects
should have nice
ASCII ART!
http://patorjk.com/software/taag/
@madrobby
madrobby / gist:4161897
Created Nov 28, 2012
Retina screen media query
View gist:4161897
@media (min--moz-device-pixel-ratio: 1.5),
(-o-min-device-pixel-ratio: 3/2),
(-webkit-min-device-pixel-ratio: 1.5),
(min-device-pixel-ratio: 1.5),
(min-resolution: 144dpi),
(min-resolution: 1.5dppx) {
/* Retina rules! */
}
@EmilHernvall
EmilHernvall / proxy.py
Last active Mar 8, 2018
Transparent proxy for rewriting web pages to include The Hoff
View proxy.py
"""
Install twisted (pip install twisted) and PIL (pip install PIL), and run the script.
On your gateway, run the following commands:
iptables -t nat -A PREROUTING -i br0 -s ! 192.168.0.20 -p tcp --dport 80 -j DNAT --to 192.168.0.20:8080
iptables -t nat -A POSTROUTING -o br0 -s 192.168.0.0/24 -d 192.168.0.20 -j SNAT --to 192.168.0.1
iptables -A FORWARD -s 192.168.0.0/24 -d 192.168.0.20 -i br0 -o br0 -p tcp --dport 8080 -j ACCEPT
Substitute 192.168.0.20 for the computer running the proxy.
"""
@ken-reitz
ken-reitz / mongo.py
Created Mar 13, 2012 — forked from lstoll/mongo.py
MongoHQ w/ pymongo on Heroku
View mongo.py
import os
import pymongo
MONGO_URL = os.environ.get('MONGOHQ_URL')
if MONGO_URL:
# Get a connection
conn = pymongo.Connection(MONGO_URL)
# Get the database
You can’t perform that action at this time.