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(exports){ | |
exports.someExportedFunction = function( ) { }; | |
})(typeof(window)!=='undefined'&&(window.utils={})||exports); |
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 a = [ 'one', 'two', 'one', 'one' ]; | |
var result = {}; | |
a.forEach( function( key ) { | |
( result[ key ] || ( result[ key ] = [] ) ).push( key ) | |
} ); | |
console.info( result ); |
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
#!/usr/bin/env node | |
var httpProxy = require( 'http-proxy' ); | |
var server = httpProxy.createServer( function( req, res, proxy ) { | |
proxy.proxyRequest( req, res, { | |
host: 'sifu.cloudant.com', | |
port: 443, | |
https: true | |
} ); |
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 groupBy( array, key ) { | |
var result = {}; | |
var by, property; | |
var item, i=0; | |
var isAlreadyFunction = typeof( key ) === 'function'; | |
if( isAlreadyFunction ) { | |
by = key; | |
} else { | |
by = function( item ) { | |
return item[ key ]; |
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 doGet() { | |
var app = UiApp.createApplication(); | |
var button = app.createButton('Click Me'); | |
app.add(button); | |
var label = app.createLabel('The button was clicked.') | |
.setId('statusLabel') | |
.setVisible(false); | |
app.add(label); |
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 dashCase( str ) { | |
return str.replace( /([A-Z])/g, function( $1 ) { | |
return '-' + $1.toLowerCase( ); | |
} ); | |
} | |
$componentLoaderProvider.setTemplateMapping( function( name ) { | |
var dashName = dashCase(name); | |
return 'components/' + dashName + '/' + dashName + '.html'; | |
} ); |
OlderNewer