Skip to content

Instantly share code, notes, and snippets.

/*
* copyright: https://github.com/atom/fuzzaldrin - https://github.com/atom/fuzzaldrin/blob/master/LICENSE.md
*/
(function(global){
var filter, scorer, FuzzySearch;
/*
Original ported from:
@aheinze
aheinze / riot.view.js
Last active August 29, 2015 14:19
riot.view.js - inline compiled view templates
/**
USAGE:
<script src="riot+compiler.min.js"></script>
<script src="riot.view.js"></script>
<script type="riot/tag" src="my-tag.tag"></script>
<div riot-view>
//
// returns a list of all elements under the cursor
//
function elementsFromPoint(x,y) {
var elements = [], previousPointerEvents = [], current, i, d;
// get all elements via elementFromPoint, and remove them from hit-testing in order
while ((current = document.elementFromPoint(x,y)) && elements.indexOf(current)===-1 && current != null) {
// push the element and its current style
@aheinze
aheinze / gist:211636e42c0c209850f1
Last active August 29, 2015 14:19
seamless-iframe.js
/**
USAGE:
Just load the script in the page loaded by the iframe.
<script src="seamless-iframe.js"></script>
**/
@aheinze
aheinze / gist:a3a702d652523021165b
Created May 28, 2015 09:19
replace color usage in style rules
(function() {
var styles, style, rules, rule, error,
props = ['backgroundColor', 'color'], primaryColor = 'red', replaceColor: 'blue';
document.body.style.visibility = 'hidden';
try {
styles = document.styleSheets;
@aheinze
aheinze / storage.js
Created September 6, 2012 10:11
Local+Session sorage wrapper
;(function(ls, ss){
var fallback = {setItem:function(){}, getItem:function(){ return null;}, removeItem:function(){}},
ls = ls || fallback},
ss = ss || fallback,
JSON = JSON || {stringify:function(){},parse:function(){}};
window.Store = {
"set": function(key, value) {
@aheinze
aheinze / gist:5704831
Last active December 18, 2015 01:38
chown -R www-data:www-data /var/www
chown -R www-data:www-data /var/www
chown -R www-data:www-data /usr/share/nginx/html

##Given Apache 2 and MySQL are already installed.

#Update MacPorts sudo port selfupdate;sudo port -u upgrade outdated

#Install PHP 5.4.* sudo port install php54 php54-apache2handler ##Activate Apache Module cd /opt/local/apache2/modules

var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs"),
port = process.argv[2] || 3000,
mimeTypes = {
'asc' : 'text/plain',
'au' : 'audio/basic',
'avi' : 'video/x-msvideo',
@aheinze
aheinze / execute.js
Last active February 25, 2016 16:05
Execute async function
/**
asyncexec(function(times){
for (var x=0, y;x<times;x++) {
y = x/2;
}
release(x);