This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//pins elements in place with JS | |
(function($){ | |
$.pinme = function(el){ | |
var base = this; | |
// Access to jQuery and DOM versions of element | |
base.$el = $(el); | |
base.el = el; | |
// Add a reverse reference to the DOM object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.titleCaps = function(){ | |
var thisString = this.replace(/( )([a-z])/g, function(m, $1, $2){return $1 + $2.toUpperCase();}); | |
//remove and, the, or of from caps if they are not the first element in the string | |
thisString = thisString.replace(/(and|of|to|the|or)/ig, function(m,$1){return $1.toLowerCase();}); | |
thisString = thisString.replace(/(^[a-z])/,function(m,$1){return $1.toUpperCase();}); | |
return thisString; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<snippet> | |
<content><![CDATA[ | |
define([ | |
'modules/PadssView' | |
], function( | |
PadssView | |
) { | |
return PadssView.extend({ | |
events: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var window = arr.length; | |
for(var i = 0; < arr.length; i++){ | |
for(var index = i; index >= 0; index--){ | |
loopOverWindow(arr,window,index); | |
} | |
window --; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
t = ['john']; | |
c = ['daniel','joe']; | |
t.push(c); | |
c.push(t); | |
c; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:!function(){var a=document.createElement("script"),b=function(){var a=$("p"),b=0,c="",d="";for(b=0;b<a.length;b++)c=$(a[b]).text(),d=c.slice(0,45)+"*"+c.slice(45,70)+"*"+c.slice(70),$(a[b]).text(d)};a.src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js",document.getElementsByTagName("head")[0].appendChild(a),setTimeout(b,500)}(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var createSummary = function(str){ | |
var str = str | |
//tag replacement stuff | |
, tagRegex = /<[^>]*>?/g | |
, markerRegexGlobal = /~/g | |
, markerRegex = /~/ | |
, marker = '~' | |
//other vars that we will need | |
, refString = str.replace(tagRegex, marker) //replace out tags | |
, i = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function delegate (childIn) { | |
var child = childIn; | |
return function me(){ | |
var that = this, | |
oper = Object.getOwnPropertyNames(that).filter(function (attrib) { | |
return(typeof that[child][attrib] === 'function' && me === that[attrib]); | |
})[0]; | |
return that[child][oper].apply(this[child], arguments); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NOTE: I previously suggested doing this through Grunt, but had plenty of problems with | |
// my set up. Grunt did some weird things with scope, and I ended up using nodemon. This | |
// setup is now using Gulp. It works exactly how I expect it to and is WAY more concise. | |
var gulp = require('gulp'), | |
spawn = require('child_process').spawn, | |
node; | |
/** | |
* $ gulp server | |
* description: launch the server. If there's a server already running, kill it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
somePromiseReturningFunction.then(function(data){ | |
data.num++; | |
return data; | |
}).then(function(data){ | |
data.num++; | |
return data; | |
}).then(function(data){ | |
data.num++; | |
return data; | |
}).then(function(data){ |
OlderNewer