Skip to content

Instantly share code, notes, and snippets.

Stepan Suvorov stevermeister

Block or report user

Report or block stevermeister

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:c2ec0c1768e1600b0d44
function goImage(){
html2canvas(document.getElementById('Stage_screen'), {
onrendered: function(canvas) {'image/jpeg'));
stevermeister / downloadFile.js
Last active Aug 29, 2015
JavaScript File download imitation
View downloadFile.js
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 ( !== undefined){
            //Set HTML5 download attribute. This will prevent file from opening if supported.
View Git pre-push hook
var grunt = require('grunt');
(function () {
'use strict';
grunt.tasks(['test'], {}, function () {
console.log('pre push hook: SUCCESS');
stevermeister / git pre-push hook
Created Mar 12, 2015
git pre-push hook to run tests
View git pre-push hook
# 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/* //')
stevermeister / ng-watch-visualisation
Created Mar 14, 2015
AngularJS watchers visualization
View ng-watch-visualisation
(function visualizeAngularWatchers() {
var i, data, scope,
count = 0,
all = document.all,
len = all.length,
test = {},
overlayMain = angular.element('<div/>');
overlayMain.css({'z-index': 9999});
stevermeister / ui-router-logger.js
Created Apr 13, 2015
AngualrJS ui-router logger snippet (helps for debug)
View ui-router-logger.js
// Credits: Adam's answer in
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 ''- 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.');
stevermeister / obect-c-javascript.js
Created May 16, 2015
Access Object-C properties in JavaScript example
View obect-c-javascript.js
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;
stevermeister / testFunc.js
Created Jun 7, 2015
Test function 600+ symbols perf
View testFunc.js
function large(a,b){
BANG="echo test"
while getopts :c OPT; do
case $OPT in
#Chicken mode engaged! Non-root execution allowed.
BANG="echo chicken!"
View gist:014339d4f8630c1537d3cdf4fcf30d13
describe('Calc', function() {
describe('service', function() {
it('should do sum', inject(function(Calc) {
You can’t perform that action at this time.