Skip to content

Instantly share code, notes, and snippets.

# Installation guide found here: http://www.phing.info/docs/guide/stable/
// First add PHP Pear
sudo apt-get install php-pear
// Adding Pear Channel
sudo pear channel-discover pear.phing.info
// Installing Pear
pear install phing/phing

Whip

(print (unwords (reverse ("DevDay" "<3" "Community"))))

Factor

{ "&lt;3" "DevDay" } "Community" prefix " " join .
@jacekk
jacekk / compiled.js
Created February 10, 2017 17:33
typescript casting and typehinting
// tsc 2.1.5
console.log('-- typehinting --');
var isTooShort = function (phrase) {
return phrase.trim().length < 3;
};
var safeExec = function (funcArg) {
try {
console.log(isTooShort(funcArg));
}
catch (ex) {
@jacekk
jacekk / list.js
Created November 21, 2017 10:46
list all non-native window props
Object.keys(window).filter(function(x) {
return window[x] instanceof Function && !/\[native code\]/.test(window[x].toString());
});
@jacekk
jacekk / git-branches-by-commit-date.sh
Created November 29, 2017 08:09 — forked from l15n/git-branches-by-commit-date.sh
List remote Git branches and the last commit's author and author date for each branch. Sort by most recent commit's author date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ai %ar by %an" $branch | head -n 1` \\t$branch; done | sort -r
@jacekk
jacekk / input.js
Last active January 12, 2018 22:20
for in vs. for of in JS / ES6
const assocArray = ['zero', 'one', 2, 3, 4];
assocArray['five'] = 5;
assocArray[7] = 'seven';
const plainObj = {
zero: '0',
one: '1',
2: 'two',
4: 4,
5: 'fifth',
@jacekk
jacekk / console-ouput.sh
Last active January 12, 2018 22:21
nodeJS imports and singletons
$ node ./test-imports.js
Ghost created
Ghost says: x
Ghost says: a
Ghost says: b
Ghost says: c
@jacekk
jacekk / ua.php
Created December 23, 2018 19:15
UA subdomain
<!DOCTYPE html>
<html>
<head>
<title>RQ debug</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<div class="row">&nbsp;</div>
#!/bin/bash
# Usage: ./s3-remove-old-files "bucket-name" "nested-path" 1000
if [ ! "$1" ]; then
echo "1st arg (bucket name) NOT specified !!"
exit 1
fi
if [ ! "$2" ]; then
echo "2nd arg (bucket sublocations) NOT specified !!"
@jacekk
jacekk / simple-pagination.js
Created March 30, 2019 17:59 — forked from kottenator/simple-pagination.js
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;