Skip to content

Instantly share code, notes, and snippets.

🤘
Learning Elixir, Discovering Phoenix

Anders Ytterström madr

🤘
Learning Elixir, Discovering Phoenix
Block or report user

Report or block madr

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
@madr
madr / russian
Last active Aug 29, 2015
Dota 2
View russian
Пожалуйста, ограничить Seach европейской ВОСТОКА РОССИИ или серверов только studid русских!
: please limit seach to EU EAST eller RUSSIAN servers only, studid russians!
Я не знаю, России, пожалуйста, говорить по-английски
: I don't know russian, please speak english
я не говорю России
: I do not speak russian
Пожалуйста, говорите Инглес вместо
@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.
"""
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/
@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
@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! */
}
View avoid-jquery-when-possible.md

Avoid jQuery When Possible

jQuery does good jobs when you're dealing with browser compatibility. But we're living in an age that fewer and fewer people use old-school browsers such as IE <= 7. With the growing of DOM APIs in modern browsers (including IE 8), most functions that jQuery provides are built-in natively.

When targeting only modern browsers, it is better to avoid using jQuery's backward-compatible features. Instead, use the native DOM API, which will make your web page run much faster than you might think (native C / C++ implementaion v.s. JavaScript).

If you're making a web page for iOS (e.g. UIWebView), you should use native DOM APIs because mobile Safari is not that old-school web browser; it supports lots of native DOM APIs.

If you're making a Chrome Extension, you should always use native APIs, not only because Chrome has almost the latest DOM APIs available, but this can also avoid performance issue and unnecessary memory occupation (each jQuery-driven extension needs a separate

@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.
"""
@erikh
erikh / hack.sh
Created Mar 31, 2012 — forked from DAddYE/hack.sh
OSX For Hackers
View hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@kennethreitz
kennethreitz / 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.