Skip to content

Instantly share code, notes, and snippets.

View JKirchartz's full-sized avatar
🤖

Joel Kirchartz JKirchartz

🤖
View GitHub Profile
@JKirchartz
JKirchartz / glitcher.py
Created August 3, 2014 05:41
Get images from CLI (or randomly from Instagram pics shared under creative commons liscensing) & glitch 'em
from PIL import Image, ImageStat, ImageEnhance
from random import *
import numpy as np
from itertools import *
import requests
import simplejson
from cStringIO import StringIO
from images2gif import writeGif
import os, sys
@JKirchartz
JKirchartz / ChromaticScales
Created September 17, 2014 19:06
Chromatic Scales & sound synthesis in Actionscript
[SWF(width=200,height=50,backgroundColor=0x666666,frameRate=24)]
var sound:Sound = new Sound();
/* ################ Set the Starting Frequency */
var freq:Number=1046.5;
/* ################ Set the Sample Rate */
var rate:Number=44100;
var phase:Number=0;
var chan:SoundChannel = new SoundChannel();
var trans:SoundTransform = new SoundTransform(0,0);
chan.soundTransform = trans;
@JKirchartz
JKirchartz / gist:c8c37b62f2e2bd0cf488
Created January 6, 2015 22:05
Mapping of currencies to their common symbol
var currencies = {
'USD': '$', 'CAD': 'CA$', 'EUR': '€', 'AED': 'AED', 'AFN': 'Af',
'ALL': 'ALL', 'AMD': 'AMD', 'ARS': 'AR$', 'AUD': 'AU$', 'AZN': 'man.',
'BAM': 'KM', 'BDT': 'Tk', 'BGN': 'BGN', 'BHD': 'BD', 'BIF': 'FBu',
'BND': 'BN$', 'BOB': 'Bs', 'BRL': 'R$', 'BWP': 'BWP', 'BYR': 'BYR',
'BZD': 'BZ$', 'CDF': 'CDF', 'CHF': 'CHF', 'CLP': 'CL$', 'CNY': 'CN¥',
'COP': 'CO$', 'CRC': '₡', 'CVE': 'CV$', 'CZK': 'Kč', 'DJF': 'Fdj',
'DKK': 'Dkr', 'DOP': 'RD$', 'DZD': 'DA', 'EEK': 'Ekr', 'EGP': 'EGP',
'ERN': 'Nfk', 'ETB': 'Br', 'GBP': '£', 'GEL': 'GEL', 'GHS': 'GH₵',
'GNF': 'FG', 'GTQ': 'GTQ', 'HKD': 'HK$', 'HNL': 'HNL', 'HRK': 'kn',
# Description:
# Anyone can have voice or op
#
# Commands:
# hubot make me an op
# hubot make <name> an op
# hubot give me voice
# hubot give <name> voice
module.exports = (robot) ->
@JKirchartz
JKirchartz / nextis.js
Created April 4, 2011 14:21
Extend xuiJS with jQuery style next & is functions
x$.extend({
'next': function() {
var n = this[0];
do{n = n.nextSibling;}
while (n && n.nodeType != 1);
return x$(n);
},
'is': function(sr) {
sr = sr.toUpperCase();
var n = this[0];
@JKirchartz
JKirchartz / clearfix.css
Created April 22, 2011 13:47
CSS-only Micro Clearfix
/* For modern browsers */
.cf:before,
.cf:after {
content:"";
display:block;
overflow:hidden;
}
.cf:after {
clear:both;
######################################################
# Redirect to separate directory for mobile site
######################################################
# Don't redirect if we're already there!
RewriteCond %{REQUEST_URI} !^/mobile/.*$
# Check Cookie to (en|dis)able redirect to mobile or stay on desktop
RewriteCond %{HTTP_COOKIE} !^.*mobile.*$ [NC]
@JKirchartz
JKirchartz / xuiAccordion.html
Created April 25, 2011 16:36
XUIjs Accordion
<!DOCTYPE html>
<html>
<head>
<title>XUIaccordion Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!--[if !IE]>-->
<!-- no blackberry support if you use IE conditionals to detect browser, but this is a demo so relax -->
<script type="text/javascript" src="http://xuijs.com/downloads/xui-2.0.0.min.js"></script>
<!-- sorry for hotlinking, XUI dudes, but this is a demo so deal with it. -->
@JKirchartz
JKirchartz / blockquote.css
Created May 5, 2011 14:56
Pure CSS Blockquote decoration
blockquote:before {
content: '\201C';
height: 0;
margin-left: -0.55em;
}
blockquote:after {
content: '\201D';
height: 50px;
margin-top: -70px;
margin-left: 360px;
@JKirchartz
JKirchartz / redirect.php
Created May 11, 2011 19:13
PHP Mobile Redirect
<?php
$agents = "/(sony|symbian|nokia|samsung|mobile|windows ce|epoc|opera mini|IEmobile|DoCoMo|nitro|j2me|midp-|cldc-|netfront|mot|up\.browser|up\.link|audiovox|blackberry|ericsson,|panasonic|philips|sanyo|sharp|sie-|ipad|ipod|iphone|portalmmm|blazer|avantgo|danger|palm|series60|palmsource|pocketpc|smartphone|rover|ipaq|au-mic,|alcatel|ericy|vodafone\/|wap1\.|wap2\.|mobile safari|android)/i";
$accepts = "/(text\/vnd\.wap\.wml|application\/vnd\.wap\.xhtml\+xml)/i";
if(preg_match($agents,$_SERVER['HTTP_USER_AGENT'])||preg_match($accepts,$_SERVER['HTTP_ACCEPT'])){
header("Location: mobile");
}
?>