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 ['require', 'jquery', 'utils/index'], (require, $, utils) -> | |
decorator = ($target) -> | |
moduleName = $target.attr('data-module') | |
require [moduleName], ((module) -> | |
if $.isFunction module.decorate | |
data = $target.data() | |
delete data.module | |
module.decorate $target, data |
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
describe 'get', -> | |
beforeEach -> | |
@sc = new Sitecore baseUrl, 'app' | |
afterEach -> | |
nock.cleanAll() | |
it 'should call the correct URL for an item', -> | |
nock baseUrl |
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
// This wont work | |
myApp.controller('EditProfileCtrl', function(UserResource) { | |
// This is a reference to _this_ current function (most of the time - its a good rule of thumb). | |
this.isLoading = false | |
UserResource.get({id: userID}) | |
.$promise.then(function(){ | |
// So in here, we're in a new function, so its a compltely different 'this' | |
this.isLoading = false |
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
# Git prompt, heavily modified from the g2 fish prompt. https://github.com/orefalo/g2/tree/master/fish | |
# | |
# Inspired from bobthefish is a Powerline-style, Git-aware fish theme optimized for awesome. | |
# | |
# You will probably need a Powerline-patched font for this to work: | |
# | |
# https://powerline.readthedocs.org/en/latest/fontpatching.html | |
# https://github.com/Lokaltog/powerline-fonts | |
set -g current_bg NONE |
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
-hMMMMMMM+ | |
`dMMMMMMMM/ | |
:MMMMMMNNNNd | |
`./shhdMMMMMMmMNNd | |
-ymMMMMMMMMMMMMNNNs` | |
.yNMMMMMMMMMMMMMMMd. | |
`/+oooshdNMMMMMMMMMMh` | |
/:-.``-/oshMMMMMMMMMMy | |
::..` .:+ohNMMMMNMMMMd |
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
makeLoaderFromShim = (toShim, fileName) -> | |
_makeGlobalLoader = (toShim) -> "exports?#{toShim}" | |
filenameRegex = new RegExp "^#{fileName}$" | |
if _.isString toShim | |
loader = _makeGlobalLoader toShim | |
{test: filenameRegex, loader: loader} |
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
AWS = require 'aws-sdk' | |
s3 = new AWS.S3() | |
bucketName = 'lambda-test' | |
region = 'us-east-1' | |
key = 'testData.json' | |
module.exports = (event, context) -> | |
console.log JSON.stringify(event, null, 2) | |
console.log 'From SNS:', event.Records[0].Sns.Message |
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 createUser(username, callback) { | |
DatabaseClient.connect() | |
.then(function(connection) { | |
return connection.collection('users') | |
}) | |
.then(function(users) { | |
return users.query({username: username}) | |
}) | |
.then(function(exising){ | |
if(existing) { |
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
randomChoice = (items) -> | |
item = items[Math.floor(Math.random()*items.length)] | |
shuffle = (array) -> | |
currentIndex = array.length | |
temporaryValue = randomIndex = null | |
# While there remain elements to shuffle... | |
while 0 isnt currentIndex | |
# Pick a remaining 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
### | |
### You'll need to install the Powerline fonts and set them up for your terminal | |
### https://github.com/powerline/fonts | |
### | |
# | |
# -- Init ------------------------------------------------- | |
# |