Skip to content

Instantly share code, notes, and snippets.

View skyrpex's full-sized avatar
👋

Cristian Pallarés skyrpex

👋
View GitHub Profile
//EnhanceJS isIE test idea
//detect IE and version number through injected conditional comments (no UA detect, no need for cond. compilation / jscript check)
//version arg is for IE version (optional)
//comparison arg supports 'lte', 'gte', etc (optional)
var isIE = (function(){
var doc = document,
function parseQueryString(qs) {
qs = qs.replace(/\+/g, ' ');
var params = {}, tokens,
re = /[?&]:?([^=]+)=([^&#]*)/g;
while (tokens = re.exec(qs)) {
// console.log(tokens);
params[decodeURIComponent(tokens[1])]
= decodeURIComponent(tokens[2]);
@jhuttner
jhuttner / git-dropbox.py
Created June 5, 2012 22:49
Easily create Dropbox remotes for your Git repositories.
#!/usr/bin/env python
import getpass
import os
import subprocess
import sys
###############################################################################
#
@fracek
fracek / monokai.xml
Created December 26, 2012 14:12
Monokai color theme for QT Creator. Found it somewhere on the 'net, slightly modified by me.
<?xml version="1.0" encoding="UTF-8"?>
<style-scheme version="1.0" name="Monokai">
<style name="Text" foreground="#e6e5e2" background="#272822"/>
<style name="Link" foreground="#66d9ef"/>
<style name="Selection" foreground="#e6e5e2" background="#49483e"/>
<style name="LineNumber" foreground="#a0a19c" background="#272822"/>
<style name="SearchResult" foreground="#ffffff" background="#2572b8"/>
<style name="SearchScope" foreground="#000000" background="#e2efff"/>
<style name="Parentheses" foreground="#ff0000" background="#c3e1ff"/>
<style name="CurrentLine" background="#3e3d32"/>
@turadg
turadg / levenshteinDistanceMixin
Last active December 15, 2015 12:09
Underscore mixin for Levenshtein distance of two strings Adapted from [Levenshtein.coffee](https://raw.github.com/phstc/levenshtein/master/src/Levenshtein.coffee) by @phstc (http://coffeescriptcookbook.com/chapters/strings/matching-strings was broken)
# usage _.levenshteinDistance("PART", "PARTY") or _("PART").levenshteinDistance("PARTY")
_.mixin
levenshtein : (str1, str2) ->
return str2.length if str1.length == 0
distance = []
for i in [0..str1.length]
distance[i] = []
distance[i][0] = i
@eXpl0it3r
eXpl0it3r / Stroke.cpp
Created July 22, 2013 20:13
Stroke - A dirty port to SFML 2.0
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include "Stroke.hpp"
#include <SFML/OpenGL.hpp>
const float myRand(float low, float high)
{
return static_cast<float>(std::rand()) / RAND_MAX * (high - low) + low;
@alecthomas
alecthomas / entityx_tx2.cc
Last active May 17, 2016 10:26
Parallel EntityX prototype
#include <utility>
#include <thread>
#include <limits>
#include <algorithm>
#include <cassert>
#include <vector>
#include <cstdint>
#include <iostream>
#include <mutex>
#include <future>
@alecthomas
alecthomas / log.cc
Last active May 17, 2016 10:26
Simple, type and thread safe C++11 console logging function
#include <iostream>
#include <mutex>
std::recursive_mutex log_lock;
// If you have ever tried using cerr/cout from multiple threads you may have experienced
// character interleaving. These functions avoid that.
template <typename A>
void log(const A &arg) {
log_lock.lock();
@pete-otaqui
pete-otaqui / css-onload.js
Created October 18, 2012 14:42
Load External Domain CSS, and get a Callback in IE7, IE8, IE9, FF, Chrome & Safari
function cssLoad(url, callback) {
var promise,
resolutions = [],
rejections = [],
resolved = false,
rejected = false,
count, id;
@dannycroft
dannycroft / chunk.lodash.js
Created November 25, 2013 19:28
Lodash / Underscore method for breaking data sets into smaller sets (chunks)
/**
* Lodash / Underscore method for breaking data sets into smaller sets (chunks)
*
* @arguments
*
* collection: Array / Object
* chuckSize: Number
*
* @example
*