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 goImage(){ | |
html2canvas(document.getElementById('Stage_screen'), { | |
onrendered: function(canvas) { | |
window.open(canvas.toDataURL('image/jpeg')); | |
} | |
}); | |
} |
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
#!/bin/sh | |
# check for how many uncommitted changes we have | |
# stash changes | |
# run grunt task | |
# restore stashed files if anything was stashed | |
# exit with error if grunt fails | |
NAME=$(git branch | grep '*' | sed 's/* //') |
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 visualizeAngularWatchers() { | |
var i, data, scope, | |
count = 0, | |
all = document.all, | |
len = all.length, | |
test = {}, | |
overlayMain = angular.element('<div/>'); | |
overlayMain.css({'z-index': 9999}); | |
angular.element(document.body).append(overlayMain); |
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
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
describe('Calc', function() { | |
beforeEach(module('myApp')); | |
describe('service', function() { | |
it('should do sum', inject(function(Calc) { | |
expect(Calc.sum(3,4)).toBe(7); | |
})); |