Skip to content

Instantly share code, notes, and snippets.

View ixtli's full-sized avatar
🌹
Typing text into boxes.

Chris Galardi ixtli

🌹
Typing text into boxes.
View GitHub Profile
@ixtli
ixtli / convert.py
Last active August 29, 2015 14:07
Convert XML to JSON using Python 2.7.x
#!/usr/bin/python
import xml.etree.ElementTree as ET;
import json, os, fnmatch, time;
def coerceStringToType(val):
if not val:
return None;
@ixtli
ixtli / fb.js
Created August 13, 2014 15:21
Facebook double init
/** subsections of sdk.js retrieved on Aug 13th, 2014 */
function init(/*object|number|string*/ options) {__t([options, 'object|number|string', 'options']);
if (Runtime.getInitialized()) {
Log.warn(
'FB.init has already been called - this could indicate a problem');
}
if (Runtime.getIsVersioned()) {
#include <stdio.h>
class Person
{
public:
virtual void aboutMe() const {
printf("I am a person.\n");
}
};
@ixtli
ixtli / no-conflict.js
Created July 29, 2014 21:58
A thing that acts as a no-conflict stack for those times when you have to mutate the global namespace.
'use strict';
define(function(require)
{
var UNDEFINED = void 0;
function NoConflict(namespace)
/**
* Apply an object's prototype as a mixin to another object's prototype
* @param {Object} destination The class to mix in to
* @param {(Object|Array)} source An object or array of objects to mix in
*/
function mixIn(destination, source)
{
if (typeof source !== TYPE_OF_ARRAY)
{
$.extend(destination.prototype, source.prototype);
<script type="text/javascript">
(window.NREUM || (NREUM = {})).loader_config = {
xpid: "VQQUUFNS"
};
window.NREUM || (NREUM = {}), __nr_require = function (t, e, n) {
function r(n) {
if (!e[n]) {
var o = e[n] = {
exports: {}
};
Your pain is the breaking of the shell that encloses your understanding. Just as the stone of the fruit must break, so that its heart may stand in the sun, so must you know pain. And if you keep your heart in wonder at the daily miracles of your life, your pain would not seem less wondrous than your joy. If you accept the seasons of your heart, as you have always accepted the four seasons, you would watch with serenity the winters of your grief. Much of your pain is self-chosen. It is the bitter potion by which the physician within you heals your sick self. Therefore, trust the physician, and drink his remedy in silence and tranquility. For his hand, though heavy and hard, is guided by the tender hand of the Unseen. - Kahlil Gibran
@ixtli
ixtli / vimrc
Last active December 29, 2015 23:49
my vimrc (install Vundle first: https://github.com/gmarik/Vundle.vim)
" Requires Vundle: https://github.com/gmarik/Vundle.vim
" Every vimconfig should start like this:
syntax on
" Basic config
set nocompatible
set autoindent
set smartindent
set copyindent
@ixtli
ixtli / deflate.py
Created May 30, 2013 05:35
Correctly samples this image: http://24.media.tumblr.com/33afdde66541395bbb3f9c8818be943a/tumblr_mmd4ozTT2g1qbgkkto1_1280.png (expected "thing.png") and outputs a "1:1" version called "deflate.png" and an explanatory reference called "grid.png"
#!/usr/bin/python
import Image;
import math;
img = Image.open("thing.png");
pixels = img.load();
width = img.size[0];
height = img.size[1];
@ixtli
ixtli / localedump.py
Created March 6, 2013 16:10
print out currency prefixes for all utf8 locales on the current POSIX compliant machine. requires python 2.7 (for the subprocess module). change utfLocaleSuffix to match the utf8 extension for locale names on your machine. you can determine this by running `locale -a | grep 'utf'` and seeing what they look like.
#!/usr/bin/python
# coding: utf-8
import locale, subprocess;
# on centos this is 'utf8'
utfLocaleSuffix = 'UTF-8'; #darwin/freebsd
def main():
# get all locales