Skip to content

Instantly share code, notes, and snippets.

function file_scan_directory($dir, $mask, $options = array(), $depth = 0) {
// Merge in defaults.
$options += array(
'nomask' => '/(\.\.?|CVS|node_modules|bower_components)$/',
'callback' => 0,
'recurse' => TRUE,
'key' => 'uri',
'min_depth' => 0,
);
srctext.replace(/(START_TEXT)(.+?)(?=END_TEXT)/, "REPLACE_TEXT");
git log --pretty=format:"%C(magenta)%h%C(yellow)%d\\ %C(cyan)%s%Cgreen\\ [%cn]" --decorate
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;36m\]\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "
@culttm
culttm / array.reduce-polyfill.js
Created August 12, 2016 09:39 — forked from lski/array.reduce-polyfill.js
Array.reduce polyfill created by MDN, made available to use with NPM
// Production steps of ECMA-262, Edition 5, 15.4.4.21
// Reference: http://es5.github.io/#x15.4.4.21
if (!Array.prototype.reduce) {
Array.prototype.reduce = function(callback /*, initialValue*/) {
'use strict';
if (this == null) {
throw new TypeError('Array.prototype.reduce called on null or undefined');
}
if (typeof callback !== 'function') {
throw new TypeError(callback + ' is not a function');
(function ($) {
var AnimatedEl = (function(){
var AnimatedEl = function (o) {
this.el = $(o.el);
this.animationType = $(o.el).data('action');
this.checkInterval = o.checkInterval;
this.timeout = null;
@culttm
culttm / README.md
Created July 14, 2016 07:36 — forked from jonathantneal/README.md
SASS @font-face mixin

Font Face

A mixin for writing @font-face rules in SASS.

Usage

Create a font face rule. Embedded OpenType, WOFF2, WOFF, TrueType, and SVG files are automatically sourced.

@include font-face(Samplino, fonts/Samplino);
in linux you fix this with the command:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
var appendNoCallback = $.fn.append;
$.fn.append = function() {
var backup = appendNoCallback.apply(this, arguments);
if(typeof arguments[1] == "function") arguments[1]();
return backup;
};
function _updateQueryStringParameter(uri, key, value) {
var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
var separator = uri.indexOf('?') !== -1 ? "&" : "?";
if (uri.match(re)) {
return uri.replace(re, '$1' + key + "=" + value + '$2');
}
else {