Skip to content

Instantly share code, notes, and snippets.

View mgol's full-sized avatar

Michał Gołębiowski-Owczarek mgol

View GitHub Profile
@mgol
mgol / jquery-bugs-migration.js
Last active April 25, 2017 10:28
jQuery bug migration script
var tickets = [
// List of tickets to migrate.
"http://bugs.jquery.com/ticket/XXXX",
"http://bugs.jquery.com/ticket/YYYY",
];
var request = require('request'),
jsdom = require('jsdom'),
apiPrefix = 'https://api.github.com/repos/jquery/jquery/';
@sidwood
sidwood / selenium.sh
Created September 1, 2014 10:45
A selenium server management script for node.js projects. Dug this relic up and updated line #7 so that it can act as a replacement for protractor's currently broken `webdriver-manager update`. Just pop this in your ./bin folder, make it executable, and run `./bin/selenium.sh install`. Jobs a good’un.
#!/usr/bin/env bash
#
# Constants
#
# DOWNLOAD_PATH=vendor/selenium
DOWNLOAD_PATH=node_modules/protractor/selenium
CD_VERSION=2.10
@dmethvin
dmethvin / gist:43ffd1c743554e5c50ae
Last active August 29, 2015 14:02
$.xhr brainstorming
// Node-like signature with single callback, returns the XHR
$.xhrcb( url: String, complete: Function( err: Error, xhr: XHR, options: Object ) ): XHR;
$.xhrcb( options: Object, complete: Function( err: Error, xhr: XHR, options: Object ) ): XHR;
// Returns a Promise, throws an error if no Promise or shim
$.xhr( options: Object ): Promise
// See ticket http://bugs.jquery.com/ticket/14509 for `options`
// Thoughts:
// bizarguments is a v8 anomaly
function abc() {
return def();
}
function def() {
return abc.arguments[0] * 2;
}
abc(50); // >> 100
@jrencz
jrencz / angular-angular
Last active August 29, 2015 14:01
Funny names across JS projects
https://github.com/angular/angular.js/blob/25a476ea096b200fb4f422aaa9cd7215e2596ad3/src/ng/directive/select.js#L145-L146
//000011111111110000000000022222222220000000000000000000003333333333000000000000004444444444444440000000005555555555555550000000666666666666666000000000000000777777777700000000000000000008888888888
var NG_OPTIONS_REGEXP = /^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/,
@xmlking
xmlking / bower.json
Last active August 29, 2015 14:00
Angular Gulp workflow with SASS and Traceur for ES6 -> ES5
{
"name": "MyApp",
"version": "0.0.1",
"private": true,
"main": "app/index.html",
"dependencies": {
"jquery": "jquery/jquery",
"angular": "1.3.0-beta.5",
"es6-shim": ">=0.8.0",
"bootstrap-sass-official": "~3.1.1",
@mgol
mgol / psa
Last active April 25, 2017 10:28
List processes matching a pattern
#!/bin/sh
# Usage: move this file to ~/bin/ and create a link ~/bin/psa-full -> psa.
# `psa STRING` will show you the output clipped to current number of columns in
# the terminal, `psa-full STRING` will give the full output.
# Tested on OS X 10.9-10.10.
if [[ "`basename "$0"`" == *-full ]]; then
COLS=10000
else

First, you install ruby-build and chruby. ruby-build is a program that knows how to download and build different ruby versions. chruby manages $PATH to control which ruby gets invoked in your shell. They work completely independently.

sudo su
cd /usr/src

git clone https://github.com/sstephenson/ruby-build.git
cd ruby-build
./install.sh
cd -
(function () {
'use strict';
const o = {
f: function () {
console.log(a);
}
};
const a = 'aaa';
o.f();
})();
@mgol
mgol / chrome-angularjs.js
Last active November 22, 2021 15:23
Chrome DevTools Snippet for AngularJS apps.
var ngAppElem = angular.element(document.querySelector('[ng-app]') || document);
window.$injector = ngAppElem.injector();
window.inject = $injector.invoke;
window.$rootScope = ngAppElem.scope();
// getService('auth') will create a variable `auth` assigned to the service `auth`.
var getService = serviceName =>
inject([serviceName, s => window[serviceName] = s]);