dotjs userscript for visualizing package.json
files (if present) underneath the tree view.
Very useful for navigating Node.JS projects
# | |
# UPDATE for 10.10.4+: please consider this patch obsolete, as apple provides a tool called "trimforce" to enable trim support for 3rd party SSDs | |
# just run "sudo trimforce enable" to activate the trim support from now on! | |
# | |
# Original version by Grant Parnell is offline (http://digitaldj.net/2011/07/21/trim-enabler-for-lion/) | |
# Update July 2014: no longer offline, see https://digitaldj.net/blog/2011/11/17/trim-enabler-for-os-x-lion-mountain-lion-mavericks/ | |
# | |
# Looks for "Apple" string in HD kext, changes it to a wildcard match for anything | |
# | |
# Alternative to http://www.groths.org/trim-enabler-3-0-released/ |
dotjs userscript for visualizing package.json
files (if present) underneath the tree view.
Very useful for navigating Node.JS projects
// Modified by bryanchow for namespace control and higher compressibility | |
// See https://gist.github.com/1649353 for full revision history from original | |
/* | |
* A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined | |
* in FIPS 180-2 | |
* Version 2.2 Copyright Angel Marin, Paul Johnston 2000 - 2009. | |
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet | |
* Distributed under the BSD License | |
* See http://pajhome.org.uk/crypt/md5 for details. |
#Understanding MVC And MVP (For JavaScript & Backbone Developers)
Before exploring any JavaScript frameworks that assist in structuring applications, it can be useful to gain a basic understanding of architectural design patterns. Design patterns are proven solutions to common development problems and can suggest structural paradigms to help guide us in adding some organization to our application.
I think patterns are exciting as they're effectively a grass roots effort that build upon the collective experience of skilled developers who have previously faced similar problems as we do now. Although developers 10 or 20 years ago may not have been using the same programming languages for implementing patterns, there are many lessons we can learn from their efforts.
In this section, we're going to review two popular patterns - MVC and MVP. The context of our exploration will be how these patterns are related to the popular JavaScript framework Backbone.js, which will be explored in greater detail later on.
// Based on fantastic jQuery useragent parser plugin https://gist.github.com/373298 | |
function parse(uaStr) { | |
var agent = { | |
platform: {}, | |
browser: {}, | |
engine: {} | |
}; | |
var ua = uaStr, | |
p = agent.platform, |
/* white button CSS VERSION */ | |
a.button-white-css { | |
display: inline-block; | |
vertical-align: middle; | |
padding: 1px; | |
line-height: 28px; | |
-moz-border-radius: 30px; | |
-webkit-border-radius: 30px; | |
border-radius: 30px; | |
-webkit-user-select: none; |
# | |
# Wide-open CORS config for nginx | |
# | |
location / { | |
if ($request_method = 'OPTIONS') { | |
add_header 'Access-Control-Allow-Origin' '*'; | |
# |
/* | |
UPDATE: this has finally been pushed to npm as `fs.extra` | |
URL: https://github.com/coolaj86/utile-fs/tree/master/fs.extra | |
*/ | |
(function () { | |
"use strict"; | |
console.warn('[Deprecated] See https://github.com/coolaj86/utile-fs'); | |
var fs = require('fs') |
exports.ext = function () { | |
var extTypes = { | |
"3gp" : "video/3gpp" | |
, "a" : "application/octet-stream" | |
, "ai" : "application/postscript" | |
, "aif" : "audio/x-aiff" | |
, "aiff" : "audio/x-aiff" | |
, "asc" : "application/pgp-signature" | |
, "asf" : "video/x-ms-asf" | |
, "asm" : "text/x-asm" |
(function() { | |
this.tmpl3 = function tmpl(str, data) { | |
var value = "var out = ''; out+=" + "'" + | |
str.replace(/[\r\t\n]/g, " ") | |
.replace(/'(?=[^%]*%>)/g,"\t") | |
.split("'").join("\\'") | |
.split("\t").join("'") | |
.replace(/<%=(.+?)%>/g, "'; out += $1; out += '") | |
.split("<%").join("';") |