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
/** | |
* Comparing a String object and a simple string | |
**/ | |
var myStringSimple = 'abcd'; | |
console.log(myStringSimple instanceof String); // false | |
console.log(typeof(myStringSimple)); // 'string' | |
var myStringObject = new String('abcd'); | |
console.log(myStringSimple instanceof String); // true |
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
Program ::= ProgramElement* | |
ProgramElement ::= Statement | |
| VariableDeclaration | |
| FunctionDeclaration | |
| ImportDeclaration | |
| ExportDeclaration | |
| ModuleDeclaration | |
ModuleSpecifier ::= StringLiteral | Path | |
ModuleDeclaration ::= "module" Id "at" String ";" |
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
var AdamsModule = (function (foo, bar) { | |
var theAnswer = 42; | |
var questionFromAnswer = function () { /** ? **/ }; | |
return { | |
getTheAnswer : function () { return theAnswer; }, | |
computeQuestion : function () { | |
questionFromAnswer(this.getTheAnswer()); | |
} | |
} | |
})(foo, bar) |
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
var i = { | |
a : function () { }, | |
BASE_VALUE: 42 | |
} |
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
Module dynamicList { | |
import xhr from '/dataSources.js'; // dataSources is another module | |
import template at '/tpls/list.js'; | |
var classNames = ['dynamic', 'vertical']; | |
var refreshInterval = 300000; //ms | |
var run = function (rootElt, params) { | |
return setInterval(function () { | |
xhr.get('/list', params, function (data) { | |
template.compile(data, rootElt, {classes: classNames}); |
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
Module ModernizrLoader { | |
import * from "./modernizr.min.js" | |
export Modernizr | |
} |
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
Copyright (c) 2015 - Xavier Cambar <@ xcambar_gmail.com> | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in |
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
var clouseau = require('clouseau-js'); | |
function alertCheck(page) { | |
var dfd = this; // `this` is a deferred! \o/ | |
page.onAlert = function (txt) { | |
if (txt !== 'MY EXPECTED MESSAGE') { | |
return dfd.reject(new Error("Unexpected message: " + txt)); | |
} | |
return dfd.resolve(page); | |
}; |
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
# | |
# Usage: | |
# ghp BUILD_DIR GIT_REPO_URL | |
# | |
function ghp () { | |
cd $0 | |
git init | |
git add -A | |
git remote add origin $1 | |
git commit -m "Generated at $(date)" |
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
<?php | |
require 'vendor/autoload.php'; | |
$hull = new Hull_Client(array( 'hull' => array( | |
'host' => 'YOUR_ORG_URL', | |
'appId' => 'YOUR_APP_ID', | |
'appSecret' => 'YOUR_APP_SECRET' | |
))); | |
$app = $hull->get('app'); | |
var_dump($app); |
OlderNewer