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
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://npmjs.org/install.sh | sh |
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
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://npmjs.org/install.sh | sh |
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
// Useful for occasions on which you know that an action will result in the re-rendering of a template | |
// (through invalidation) and you want to execute task(s) once the rendering is complete in response. | |
// Sometimes, you only need to execute these task(s) in response to that specific action, so it doesn't | |
// make sense to add the task(s) to the normal "rendered" callback and then test if they need to be executed | |
// every time the template is rendered. | |
renderOnce = function(template, oneTimeFunc, afterwards) { | |
// template: either a Meteor Template instance, or the string name of such an instance | |
// oneTimeFunc: the function you are attaching to the "rendered" callback to be run only once | |
// afterwards: set to true if you need the oneTimeFunc to be executed after the normal "rendered" callback, | |
// rather than before 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
javascript: (function() { | |
var getCollections = function() { | |
var collections = []; | |
for (var item in window) { | |
if (window[item] && window[item]['_collection']) collections.push(item); | |
} | |
return collections; | |
}; | |
var getSubscriptions = function() { | |
var thisSub, subs = {}; |
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
<link rel="import" href="../core-icon-button/core-icon-button.html"> | |
<link rel="import" href="../core-toolbar/core-toolbar.html"> | |
<link rel="import" href="../core-header-panel/core-header-panel.html"> | |
<link rel="import" href="../core-item/core-item.html"> | |
<link rel="import" href="../chart-js/chart-js.html"> | |
<link rel="import" href="../paper-calculator/paper-calculator.html"> | |
<link rel="import" href="../topeka-elements/avatars.html"> | |
<link rel="import" href="../core-icon/core-icon.html"> | |
<polymer-element name="my-element"> |
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
// initial - Initial value (must be an object) | |
// name - a name to help identify the object if you're using objectStore | |
// objectStore - a central store to push all initialised objects into (for debugging) | |
// maxInvalidate - the maximum number of times to invalidate computations which depend | |
// on this object. Avoids and helps diagnose infinite invalidation loops in testing. | |
// | |
// note that setting a sub-key on a key which is currently literal-valued will delete | |
// the existing value | |
ReactiveObject = function(initial, name, objectStore, maxInvalidate) { |
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
// Underscore mixin to allow arguments to be passed to debounced functions. | |
// Useful for updating user doc on keyup (or similar) where doc update will invalidate | |
// many dependent computations, and so you only want to actually update it every so often. | |
// See below for example. | |
// Can also be used without Meteor (change Meteor.setTimeout to Timeout), and without | |
// underscore (just make debounceWithArgs a stand-alone function). | |
_.mixin({ | |
debounceWithArgs: function(func, timeOutDuration) { | |
var timeOut, |
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 calledFromServer; | |
Meteor.methods({ | |
'getThis': function() { | |
return this; | |
}, | |
'getThisServer': function() { | |
return calledFromServer; | |
} |
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 generateNINO(style) { | |
var group1 = ''; | |
var group2 = ''; | |
var group3 = ''; | |
var group4 = ''; | |
var group5 = ''; | |
var randomArrayIndex = ''; | |
var notAllowed = new Array('GB', 'BG', 'NK', 'KN', 'TN', 'NT', 'ZZ'); | |
var firstAllowed = new Array('A', 'B', 'C', 'E', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'T', 'W', 'X', 'Y', 'Z'); | |
var secondAllowed = new Array('A', 'B', 'C', 'E', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'R', 'S', 'T', 'W', 'X', 'Y', 'Z'); |
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 randomLetter = function() {return String.fromCharCode(Math.floor(Math.random()*26) + 65);} | |
var randomNumber = function() {return String.fromCharCode(Math.floor(Math.random()*10) + 48);}; | |
var genDict = { | |
'l': randomLetter, | |
'n': randomNumber | |
}; | |
// pass in a format string of the type: "4l 3n 2l", i.e. a space-delimited set of number/letter | |
// pairs, the first of which gives the number of characters of the given type and the second | |
// denotes the type: "n" for number, "l" for letter (always upper-case). |
OlderNewer