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
# Path to your oh-my-zsh configuration. | |
ZSH=$HOME/.oh-my-zsh | |
ZSH_THEME="smt" | |
COMPLETION_WAITING_DOTS="true" | |
plugins=(git github osx sublime) | |
source $ZSH/oh-my-zsh.sh | |
unsetopt correct_all | |
export NODE_PATH=/usr/local/lib/node |
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 config = { | |
"USER" : "", | |
"PASS" : "", | |
"HOST" : "ec2-xx-xx-xx-xx.ap-southeast-2.compute.amazonaws.com", "PORT" : "27017", | |
"DATABASE" : "my_example" | |
}; | |
var dbPath = "mongodb://" + config.USER + ":" + config.PASS + "@" + config.HOST + ":" + config.PORT + "/" + config.DATABASE; | |
var mongoose = require('mongoose'); | |
var db = mongoose.connect(dbPath); |
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
selectedText: function() { | |
var html = ''; | |
if (typeof window.getSelection !== "undefined") { | |
var sel = window.getSelection(); | |
if (sel.rangeCount) { | |
var container = document.createElement("div"); | |
for (var i = 0, len = sel.rangeCount; i < len; ++i) { | |
container.appendChild(sel.getRangeAt(i).cloneContents()); | |
} |
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
emailValid: function(email) { | |
// see: http://stackoverflow.com/questions/46155/validate-email-address-in-javascript | |
var re; | |
re = /^[a-zA-Z0-9!#$%&'*+\/=?\^_`{|}~\-]+(?:\.[a-zA-Z0-9!#$%&'\*+\/=?\^_`{|}~\-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/; | |
return re.test(email); | |
} |
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
/** | |
A simple key value store that uses LocalStorage | |
@class KeyValueStore | |
@namespace Discourse | |
@module Discourse | |
**/ | |
Discourse.KeyValueStore = { | |
initialized: false, | |
context: "", |
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
uniqueId = function() { | |
return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) { | |
var r, v; | |
r = Math.random() * 16 | 0; | |
v = c === 'x' ? r : (r & 0x3 | 0x8); | |
return v.toString(16); | |
}); | |
}; |
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
define(['main/config'], function (config) { | |
App.AccordionItemView = Ember.View.extend({ | |
classNames: ['accordion-group'], | |
parentId: null, | |
parentRef: function() { | |
var hasGroupControl = this.get('parentView.hasGroupControl'); | |
return (hasGroupControl) ? "#" + this.get('parentId') : ""; | |
}.property('parentId'), | |
internalId: null, |
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
// Animates the dimensional changes resulting from altering element contents | |
// Usage examples: | |
// $("#myElement").showHtml("new HTML contents"); | |
// $("div").showHtml("new HTML contents", 400); | |
// $(".className").showHtml("new HTML contents", 400, | |
// function() {/* on completion */}); | |
(function($) | |
{ | |
$.fn.showHtml = function(html, speed, callback) | |
{ |