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 hello= 'bonjour'; | |
var will = { | |
hello : 'hello', | |
tab : [1,2], | |
say : function(){ | |
console.info(this.hello) | |
}, | |
iterateSay : function(){ | |
this.tab.every(function(value, index){ |
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 objet1 = { | |
prop1 : 'objet1.prop1', | |
prop2 : 'something Else' | |
}; | |
//some kind forEach over object properties in ES5 | |
Object.keys(objet1).forEach((key)=> { | |
console.info(objet1[key]); | |
}); |
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
function authInterceptor($httpProvider) { | |
$httpProvider.interceptors.push(($timeout, $q, $injector, userStorage) => { | |
let $http, $state, $mdDialog, $mdToast, $signin; | |
// this trick must be done so that we don't receive | |
// `Uncaught Error: [$injector:cdep] Circular dependency found` |
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
<!DOCTYPE html> | |
<html ng-app="demoApp"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<meta name="author" content="Erwan DATIN"> | |
<!-- angularjs --> |
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
function get(url) { | |
// Return a new promise. | |
return new Promise(function(resolve, reject) { | |
// Do the usual XHR stuff | |
var req = new XMLHttpRequest(); | |
req.open('GET', url); | |
req.onload = function() { | |
// This is called even on 404 etc | |
// so check the status |
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
{ | |
"parser": "babel-eslint", | |
"env": { | |
"browser": true, | |
"node": true, | |
"es6": true | |
}, | |
"plugins": ["react"], |
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
{ | |
"ecmaFeatures": { | |
"modules": true | |
}, | |
"rules": { | |
"quotes": [ 2, "single" ], | |
"semi": [ 2, "always" ], | |
}, | |
"env": { | |
"es6": 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
Disclaimer: The instructions are the collective efforts from a few places online. | |
Nothing here is my original. But I want to put them together in one place to save people from spending the same time as I did. | |
First off, bundle. | |
================== | |
1. cd to the project directory | |
2. Start the react-native packager if not started | |
3. Download the bundle to the asset folder: | |
curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle" |
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
if (!window.location.origin) { | |
window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: ''); | |
} |
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
declare let componentHandler: any; // need to use external in angular2? Ok no pb, but declare it before like that | |
@Component({ | |
selector: 'app', | |
... | |
}) | |
export class App implements AfterViewInit { | |
ngAfterViewInit() { | |
componentHandler.upgradeDom(); // upgrade all mdl components |