Skip to content

Instantly share code, notes, and snippets.

View alexlouden's full-sized avatar
🐶
👋

Alex Louden alexlouden

🐶
👋
View GitHub Profile
@alexlouden
alexlouden / index.html
Last active August 29, 2015 13:56 — forked from anonymous/An-Anonymous-Pen.markdown
Three circles in one div
<div></div>
(function($) {
$.fn.textfill = function(maxFontSize) {
maxFontSize = parseInt(maxFontSize, 10);
return this.each(function(){
var ourText = $("span", this),
parent = ourText.parent(),
maxHeight = parent.height(),
maxWidth = parent.width(),
fontSize = parseInt(ourText.css("fontSize"), 10),
multiplier = maxWidth/ourText.width(),
@alexlouden
alexlouden / scrollbar.sass
Created March 25, 2015 13:02
Subtle scrollbar
::-webkit-scrollbar
width: 10px
height: 10px
::-webkit-scrollbar-thumb
background-color: rgba(50,50,50,.25)
border: 2px solid transparent
border-radius: 10px
background-clip: padding-box
@alexlouden
alexlouden / replace_outline.sass
Created May 20, 2015 14:30
Replace Chrome link outline with box-shadow
// Replace outline with box-shadow
// because it was wrapping around after psudo element border
outline: 0
// white rectangle inside grey rectangle
// 2px offset down to center
// 1px blur
box-shadow: 0 2px 1px 3px white, 0 2px 1px 6px rgba(119, 119, 119, 0.4)
@alexlouden
alexlouden / terraform_diffs.log
Created May 28, 2015 05:17
aws_security_group - diffs didn't match during apply
aws_security_group.worker
2015/05/28 11:48:42 [TRACE] Graph after step *terraform.RootTransformer:
aws_security_group.worker
2015/05/28 11:48:42 [DEBUG] vertex root.mymodule.aws_security_group.worker: walking
* DependencyViolation: resource sg-api has a dependent object
2015/05/28 11:48:42 [DEBUG] vertex root.mymodule.aws_security_group.worker: evaluating
2015/05/28 11:48:42 [DEBUG] root.mymodule: eval: *terraform.EvalSequence
2015/05/28 11:48:42 [DEBUG] root.mymodule: eval: terraform.EvalNoop
def factorial(x):
result = 1
for i in xrange(1, x + 1):
result *= i
return result
######################################################################
def _if(test):
return lambda alternative: \
import json
from shapely.geometry.base import BaseGeometry
from shapely.geometry import shape, mapping
class ShapelyEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, BaseGeometry):
return mapping(obj)
return json.JSONEncoder.default(self, obj)
import timeit
setup = """
import random, operator
class Test():
def __init__(self, t):
self.test = t
l = [Test(str(i)) for i in range(1000)]
# Adjust device pixel ratio
setMaximumPixelRatio = (p_maximumRatio=1) ->
canvas = document.createElement('canvas')
context = canvas.getContext('2d')
devicePixelRatio = window.devicePixelRatio || 1
backingStoreRatio = context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || context.backingStorePixelRatio || 1
pixelRatio = devicePixelRatio / backingStoreRatio
for className in ["HitCanvas", "SceneCanvas", "Canvas"]
Kinetic[className].prototype.init = ((p_method) -> (p_config={}) ->
parseInt(getComputedStyle($('#hours'), ':after').top)/-76*60*60 +
parseInt(getComputedStyle($('#seconds'), ':after').top)/-76 +
parseInt(getComputedStyle($('#minutes'), ':after').top)/-76*60 +
parseInt(getComputedStyle($('#centiseconds'), ':after').top)/-76/100