Skip to content

Instantly share code, notes, and snippets.

View mgol's full-sized avatar

Michał Gołębiowski-Owczarek mgol

View GitHub Profile
@NV
NV / Readme.md
Last active May 28, 2023 20:42
Prepend the debugger statement to a function as easy as stopBefore('Element.prototype.removeChild'). Works in Chrome DevTools and Safari Inspector, doesn’t work in Firebug‘s and Firefox Developer Tools‘ console (I don’t know why). Works as a standalone script everywhere.

stopBefore.js

2min screencast

Examples

stopBefore(document, 'getElementById')
stopBefore('document.getElementById') // the same as the previous
stopBefore(Element.prototype, 'removeChild')
@rwaldron
rwaldron / timer.js
Created May 24, 2013 20:06
Something more scalable and organized then tacking junk onto the global object.
[[Global]].Timer = {};
Timer.Frame = function(handler) {
// ... does what rAF(handler) would do
};
Timer.Frame.prototype.cancel = function() {
// kills this Timer.Frame instance
};
@mathiasbynens
mathiasbynens / opera-15-regressions.md
Last active September 23, 2023 14:50
List of things that broke with the Opera 15 release due to the switch to Blink/Chromium (Web features, not UI-specific stuff)
hooks.method = function() {
if (supportTestPasses()) {
delete hooks.method;
return;
}
hooks.method = function () {
// current hook code here
}
return hooks.method();
};
@mgol
mgol / git-fixed.sh
Last active April 25, 2017 10:27
Show the sorted list of tickets fixed between 2 given commits.
#!/bin/sh
# Show the sorted list of tickets fixed between 2 given commits.
if [ $# -ne 2 ]; then
echo "USAGE: `basename $0` commit1id commit2id"
exit 1
fi
git log --ancestry-path $1..$2 | egrep -i 'fix|fixes|fixed' | grep '#' | cut -f2 -d'#' | awk '{ printf "%d\n", $1 }' | sort
@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]);
(function () {
'use strict';
const o = {
f: function () {
console.log(a);
}
};
const a = 'aaa';
o.f();
})();

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 -
@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
@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",