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
window.downloadFile = function(sUrl) { | |
//If in Chrome or Safari - download via virtual link click | |
if (window.downloadFile.isChrome || window.downloadFile.isSafari) { | |
//Creating new link node. | |
var link = document.createElement('a'); | |
link.href = sUrl; | |
if (link.download !== undefined){ | |
//Set HTML5 download attribute. This will prevent file from opening if supported. |
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
#!/bin/node | |
var grunt = require('grunt'); | |
(function () { | |
'use strict'; | |
grunt.tasks(['test'], {}, function () { | |
console.log('pre push hook: SUCCESS'); | |
process.exit(0); | |
}); |
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
ObjC.import("Cocoa"); | |
var styleMask = $.NSTitledWindowMask | $.NSClosableWindowMask | $.NSMiniaturizableWindowMask; | |
var windowHeight = 350; | |
var windowWidth = 550; | |
var window = $.NSWindow.alloc.initWithContentRectStyleMaskBackingDefer( $.NSMakeRect(0, 0, windowWidth, windowHeight), styleMask, $.NSBackingStoreBuffered, false ); | |
var label = $.NSTextField.alloc.initWithFrame($.NSMakeRect(25, (windowHeight - 40), 200, 24)); | |
label.stringValue = "Label:"; | |
label.drawsBackground = false; | |
label.editable = false; |
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 large(a,b){ | |
//lkfajsd;flkdsajflk;dsadklsjflk;dsajflk;dsadjflksdajfl;kadsjfkldsajflsda;fj | |
//asl;fjsadlkfjdsal;kfjads;klfjdsakldkl;afjdsakl;fjdls;akfjklsd;ksdjadfjls | |
//lkfajsd;flkdsajflk;dsadklsjflk;dsajflk;dsadjflksdajfl;kadsjfkldsajflsda;fj | |
//asl;fjsadlkfjdsal;kfjads;klfjdsakldkl;afjdsakl;fjdls;akfjklsd;ksdjadfjls | |
//lkfajsd;flkdsajflk;dsadklsjflk;dsajflk;dsadjflksdajfl;kadsjfkldsajflsda;fj | |
//asl;fjsadlkfjdsal;kfjads;klfjdsakldkl;afjdsakl;fjdls;akfjklsd;ksdjadfjls | |
//lkfajsd;flkdsajflk;dsadklsjflk;dsajflk;dsadjflksdajfl;kadsjfkldsajflsda;fj |
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
#!/bin/sh | |
BANG="echo test" | |
while getopts :c OPT; do | |
case $OPT in | |
c|+c) | |
#Chicken mode engaged! Non-root execution allowed. | |
BANG="echo chicken!" | |
chicken=1 |
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
data:text/html, <style type="text/css">.e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div class="e" id="editor"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("editor");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script> | |
<!-- | |
For other language: Instead of `ace/mode/ruby`, Use | |
Markdown -> `ace/mode/markdown` | |
Python -> `ace/mode/python` | |
C/C++ -> `ace/mode/c_cpp` | |
Javscript -> `ace/mode/javascript` | |
Java -> `ace/mode/java` | |
Scala- -> `ace/mode/scala` |
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
describe('Calc', function() { | |
beforeEach(module('myApp')); | |
describe('service', function() { | |
it('should do sum', inject(function(Calc) { | |
expect(Calc.sum(3,4)).toBe(7); | |
})); |
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
// Credits: Adam's answer in http://stackoverflow.com/a/20786262/69362 | |
var $rootScope = angular.element(document.querySelectorAll("[ui-view]")[0]).injector().get('$rootScope'); | |
$rootScope.$on('$stateChangeStart',function(event, toState, toParams, fromState, fromParams){ | |
console.log('$stateChangeStart to '+toState.to+'- fired when the transition begins. toState,toParams : \n',toState, toParams); | |
}); | |
$rootScope.$on('$stateChangeError',function(event, toState, toParams, fromState, fromParams){ | |
console.log('$stateChangeError - fired when an error occurs during transition.'); | |
console.log(arguments); |
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
const getPostOne$ = Rx.Observable.timer(3000).mapTo({id: 1}); | |
const getPostTwo$ = Rx.Observable.timer(1000).mapTo({id: 2}); | |
Rx.Observable.concat(getPostOne$, getPostTwo$).subscribe(res => console.log(res)); |
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
import {Directive, Input, TemplateRef, ViewContainerRef} from '@angular/core'; | |
@Directive({ | |
selector: '[appDelay]' | |
}) | |
export class DelayDirective { | |
constructor( | |
private templateRef: TemplateRef<any>, | |
private viewContainerRef: ViewContainerRef | |
) { } |