Skip to content

Instantly share code, notes, and snippets.

View yanivefraim's full-sized avatar

Yaniv Efraim yanivefraim

View GitHub Profile
@yanivefraim
yanivefraim / index.js
Last active November 10, 2016 15:06 — forked from franciscolourenco/index.js
requirebin sketch
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
axios = require('axios')
myAxios = axios.create()
// Response 2
var getC = function(bData){
var d = new $.Deferred();
var cData = {id: bData.id + "+id_c"};
console.log("getC");
d.resolve(cData);
return d.promise();
};
var getB = function(aData){
var d = new $.Deferred();
var getCData = function(){
var deferred = new $.Deferred();
getA()
.then(function(aData){
getB(aData)
.then(function(bData){
getC(bData)
.then(function(cData){
deferred.resolve(cData);
}, function(error_c){
var getCData = function(){
return getA()
.then(getB)
.then(getC)
.fail(error);
};
<script src="main.min.55a94a50.js"></script>
<link rel="stylesheet" href="main.min.6e4ea0cc.css"></head>
hashres: {
options: {
// Optional. Encoding used to read/write files. Default value 'utf8'
encoding: 'utf8',
// Optional. Format used to name the files specified in 'files' property.
// Default value: '${hash}.${name}.cache.${ext}'
fileNameFormat: '${name}.${hash}.${ext}',
// Optional. Should files be renamed or only alter the references to the files
// Use it with '${name}.${ext}?${hash} to get perfect caching without renaming your files
// Default value: true
@yanivefraim
yanivefraim / grunt
Created January 4, 2015 08:23
Installing grunt-hashres
npm install grunt-hashres
@yanivefraim
yanivefraim / app.templates.js
Last active August 29, 2015 14:12
This is an example for a auto compiled html2js templates file, for my blog post: http://fedmemoirs.blogspot.co.il/2014/12/pre-caching-angularjs-templates-using.html
angular.module('app.templates', []).run(['$templateCache', function($templateCache) {
$templateCache.put("app.templates",
"<script type=text/ng-template id=timerTemplate.html><div class=\"timer\">{{timer.time}}</div></script><script type =text/ng-template id=videoTemplate.html><video id=\"video\" class=\"video-full-screen\" controls=\"true\">\n" +
" <source id=\"mp4\" ng-src=\"{{ videoDataUrlMp4 }}\" type=\"video/mp4\">\n" +
" <p>Your user agent does not support the HTML5 Video element.</p>\n" +
" </video></script><script type=text/ng-template id=videoPageTemplate.html><div>\n" +
" <demo-timer></demo-timer>\n" +
" <demo-video video-data=\"videoPageCtrl.videoData\"><demo-video>\n" +
" </div></script>");
}]);