Skip to content

Instantly share code, notes, and snippets.

View tunnckoCore's full-sized avatar
🔒
Fighting for freedom, security and privacy 🔐

Charlike Mike Reagent tunnckoCore

🔒
Fighting for freedom, security and privacy 🔐
View GitHub Profile
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
@tunnckoCore
tunnckoCore / dual-emitter.js
Last active August 29, 2015 14:07
DualEmitter.js cross-browser + node.js event emitter. Invoke custom or DOM event. Micro library in 35lines without jQuery!!!
(function (name, that, fn) {
if (typeof module !== 'undefined') {
module.exports = fn();
} else if (typeof define === 'function' && define.amd) {
define(fn);
} else {
that[name] = fn();
}
})('DualEmitter', this, function DualEmitter($) {
$ = $ || this;
var MultiGetSet = function(opt){
var getType = function(o) {
return ({}).toString.call(o).match(/\s([a-zA-Z]+)/)[1].toLowerCase()
};
if(!opt.public || !opt.private)
return opt.public;
if(opt.handler && opt.handler.init)
/**
* Object.prototype.watch polyfill
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/watch
*
* Known limitations:
* - `delete object[property]` will remove the watchpoint
*
* Based on Eli Grey gist https://gist.github.com/eligrey/384583
* Impovements based on Xose Lluis gist https://gist.github.com/XoseLluis/4750176
* This version is optimized for minification
@tunnckoCore
tunnckoCore / person.ajs
Last active August 29, 2015 14:07 — forked from tj/person.ajs
// Alternative JavaScript Syntax
Person = :(name, address) { @name!, @address! }
Person::inspect = :{ <: "{@name} lives at {@address}" }
tj := Person('TJ', '314 Bessborough ave')
bob := Person('Bob', 'Some place')
[tj, bob].each(:(person){ print(person.inspect()) })
@tunnckoCore
tunnckoCore / .jshintrc
Last active August 29, 2015 14:08 — forked from haschek/.jshintrc
JSHint defaults
{
// JSHint Default Configuration File (as on JSHint website)
// See http://jshint.com/docs/ for more details
"maxerr" : 50, // {int} Maximum error before stopping
// Enforcing
"bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)
"camelcase" : false, // true: Identifiers must be in camelCase
"curly" : true, // true: Require {} for every new block or scope
@tunnckoCore
tunnckoCore / chooser.js
Last active August 29, 2015 14:09 — forked from kentcdodds/chooser.js
JSHint Chooser
// Just paste this into the console on http://www.jshint.com/docs/options/
(function() {
var i, row, link, span, extraCol, checkbox, value;
var rows = document.querySelectorAll('table.options tr');
var links = document.querySelectorAll('table.options a');
// add checkboxes
for (var i = 0; i < rows.length; i++) {
row = rows[i];
@tunnckoCore
tunnckoCore / 1-ubuntu-trusty-after-fresh-install.md
Last active August 29, 2015 14:10
Ubuntu 14.04+ (Trusty Tahr) - after fresh install (02 Dec, 2014)

Ubuntu 14.04+ 32bit (ubuntu-mate.org)

Simple steps for installing required tools after fresh Ubuntu install.
Or use installer and uninstaller scripts, they won't break anythng!!

Included

  • Licensed Sublime Text 3 (build 3065)
  • Nginx 1.6.2+ (latest stable)
  • PHP 5.6.4+ (latest stable)
  • NVM v0.22.0+ (for Node.js and NPM)
@tunnckoCore
tunnckoCore / gist:0b978d2531b1135be9cf
Last active April 15, 2017 09:13 — forked from muhqu/gist:4003563
PHP Mustache-like Template Engine (preg_replace_callback)
<?php
class Template {
function __construct($code, $escape = null) {
$this->code = $code;
$this->preparsed = null;
$this->escape = $escape;
}
#!/usr/bin/env bash
# Use this one-liner to produce a JSON literal from the Git log:
git log \
--pretty=format:'{%n "commit": "%H",%n "author": "%an <%ae>",%n "date": "%ad",%n "message": "%f"%n},' \
$@ | \
perl -pe 'BEGIN{print "["}; END{print "]\n"}' | \
perl -pe 's/},]/}]/'