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
@tunnckoCore
tunnckoCore / LICENSE.txt
Last active March 8, 2018 11:17 — forked from 140bytes/LICENSE.txt
async-waterfall in 131 bytes! Runs an array of functions in series, each passing their results to the next in the array and all of them can have initial context.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011-2015 Charlike Mike Reagent <http://j.mp/1stW47C>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@tunnckoCore
tunnckoCore / LICENSE.txt
Last active August 29, 2015 14:16 — forked from 140bytes/LICENSE.txt
Custom split function. A tweet-sized, fork-to-play, custom split function implementation, lol. But it is **very very** slow!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011-2015 Charlike Mike Reagent <http://j.mp/1stW47C>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
function scramble(input) {
return input.replace(/\b(\w)(\w{2,})(\w)\b/g, function(all, a, b, c) {
return a
+ b.split('').sort(function(){return Math.random()-.2}).join('')
+ c;
});
}
input = prompt("Enter the message you want scrambled:");
console.log(scramble(input));
#!/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/},]/}]/'
@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;
}
@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 / .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 / 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()) })
/**
* 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
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)