Skip to content

Instantly share code, notes, and snippets.

View efeminella's full-sized avatar

Eric Feminella efeminella

View GitHub Profile
@efeminella
efeminella / killds
Created April 2, 2013 17:01
Recursively delete all (ever annoying) .DS_Store files.
function killDs() {
find . -name ".DS_Store" -exec rm -rf {} \;
}
@efeminella
efeminella / killvpn
Created April 2, 2013 17:03
Kill Cisco VPN process (useful for which would otherwise require a system restart).
function killvpn() {
ps -ef | grep racoon | grep -v grep | awk '{print $2}' | xargs kill -9
}
@efeminella
efeminella / backbone-persistable-collection.js
Created April 9, 2012 21:10
A Persistable Backbone Collection Implementation
/*!
* Copyright (c) 2012 Eric Feminella, http://code.ericfeminella.com/license/LICENSE.txt
*/
( function( _, Backbone )
{
// convenience reference to the Backbone.Collection constructor
var _initialize = Backbone.Collection.prototype.initialize;
/*
* The Backbone.PersistableCollection provides a simply abstraction which
@efeminella
efeminella / ios-html5-input-element-tips.html
Last active February 27, 2017 07:44
An example which demonstrates how to override default behaviors of the iOS Keyboard for Mobile Web Applications.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>iOS HTML5 input element Example</title>
<meta name="author" content="Eric Feminella" />
<script src="http://code.jquery.com/jquery.min.js"></script>
<style>
@efeminella
efeminella / reyarn.sh
Last active July 12, 2018 15:21
Simple Bash script which cleans yarn cache / node_modules dir and reinstalls
#!/bin/bash
# Simple Bash script which cleans yarn cache / node_modules dir and reinstalls
# Source it from .bashrc, and run from dir $ reyarn
function reyarn() {
local BEGIN='\x1B[33m[BEGIN]: ';
local SUCCESS='\x1B[32m[SUCCESS]: ';
local FAILURE='\x1B[31m[FAILURE]: ';
local CLEAR='\x1B[0m';
printf '\n\n';
@efeminella
efeminella / enhance.helper.js
Created March 14, 2012 04:57
Plain text URL to anchor tags Handlebars Helper
// Plain text URL to anchor tags Handlebars Helper
(function(){
// defines markup enhancement regex
var protocol = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim
, scheme = /(^|[^\/])(www\.[\S]+(\b|$))/gim;
/*
* Registers a Helper method with handlebars which, given a string of
* plain text or existing markup, provides enhancements of plain text
@efeminella
efeminella / comparator-min.js
Created March 11, 2012 06:21
Simple Comparator API for JavaScript
var Comparator=Comparator||(function(){var c=function(g,f){return this[g]===f};var a=function(f){if(!this.hasOwnProperty(f)){this[f]=undefined}};var b=function(g,m,f){var k=g.prototype,o=(f?f.length:0),j=0,l,h;for(j;j<o;j++){l=f[j];h="is"+l.replace(/^./,l.match(/^./)[0].toUpperCase());if(k[h]===undefined){k[h]=(function(){return c}(m,l))}}};var d=function(g,k,f){var i=g.prototype,h,j;for(h in f){j=f[h];if(i[h]===undefined){i[h]=(function(){return c}(k,j))}}};var e=function(g,h,f){if(g.constructor!=Object){a.call(g.prototype,h);if(Object.prototype.toString.call(f)==="[object Array]"){return b(g,h,f)}return d(g,h,f)}else{throw new Error("Attempting to augment Object prototype")}};return{each:e}}());
@efeminella
efeminella / gist:1937609
Created February 29, 2012 04:13
Loading external Handlebars Templates with jQuery or Zepto
/*
* Extends Handlebars with a basic get method for loading external
* Handlebars templates. Simply pass an options object which contains
* the following properties:
* - path (required) : Path to the external template file to be loaded
* - success (required) : Callback invoked with the compiled loaded template.
* - cache (optional) : true if the template is to be cached, otherwise false.
*
* In addition to the above arguments, any jQuery/Zepto.ajax options argument
* can be specified as well.