This file contains 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
"month in months track by $index".match(/^\s*(.+)\s+in\s+(.*?)(?:\s+track\s+by\s+(.+?))?\s*$/); |
This file contains 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
/**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
* Anchor Smooth Scroll - Smooth scroll to the given anchor on click | |
* adapted from this stackoverflow answer: http://stackoverflow.com/a/21918502/257494 | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ | |
angular.module('yourapp').directive('anchorSmoothScroll', function($location) { | |
'use strict'; | |
return { | |
restrict: 'A', | |
replace: false, |
This file contains 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
# From https://github.com/github/hubot/issues/648#issuecomment-78796436 | |
The book Automation and Monitoring with Hubot has a section on debugging. | |
I've just tested that myself, and it seems to work well. Basically, the steps are: | |
npm install -g node-inspector | |
node-inspector --no-preload --web-port 8123 | |
Then, we can insert debugger in our code somewhere to setup a breakpoint. Then we run Hubot: |
This file contains 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
/* | |
* Star Wars opening crawl from 1977 | |
* | |
* I freaking love Star Wars, but could not find | |
* a web version of the original opening crawl from 1977. | |
* So I created this one. | |
* | |
* I wrote an article where I explain how this works: | |
* http://timpietrusky.com/star-wars-opening-crawl-from-1977 | |
* |
This file contains 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
// Use waterfall so that you can easily disconnect at the end of your code. | |
// It also makes node.js callbacks less confusing. | |
async.waterfall([ | |
function (wCb) { | |
connection.connect(); | |
// wCB is a callback function. Call it when you want to move to the | |
// next function in the waterfall | |
wCb(); | |
}, | |
function (wCB) { |
This file contains 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
<!doctype html> | |
<title>My Appola</title> | |
<script src="lodash.js"></script> | |
<script src="JocalStorage.js"></script> | |
<script src="mithril.js"></script> | |
<script> | |
JocalStorage.init(); | |
// create mithril module | |
var todo = {}; |
This file contains 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
return function (_array, _id) { | |
var _result = {}; | |
var _clean_array = _.compact(_array); | |
_result.next = _clean_array[($.inArray(_id, _clean_array) + 1) % _clean_array.length]; | |
_result.prev = _clean_array[($.inArray(_id, _clean_array) - 1 + _clean_array.length) % _clean_array.length]; | |
return _result; | |
}; |
This file contains 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
// http://yuiblog.com/blog/2007/06/12/module-pattern/ | |
//Self-Executing Anonymous Func: Part 2 (Public & Private) | |
(function( skillet, $, undefined ) { | |
//Private Property | |
var isHot = true; | |
//Public Property | |
skillet.ingredient = 'Bacon Strips'; |
This file contains 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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Title</title> | |
<meta name="description" content="The HTML5 Herald"> | |
<meta name="author" content="SitePoint"> |
This file contains 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
$.ajax({ | |
type: "POST", | |
url: "/route/to/dealie", | |
dataType: 'json', | |
data: { | |
var1 : var1, | |
var2 : var2 | |
}, | |
// given a json object with result property | |
success: function(response) { |
NewerOlder