Skip to content

Instantly share code, notes, and snippets.

View mgol's full-sized avatar

Michał Gołębiowski-Owczarek mgol

View GitHub Profile
@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]+?))?$/,
// bizarguments is a v8 anomaly
function abc() {
return def();
}
function def() {
return abc.arguments[0] * 2;
}
abc(50); // >> 100
@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:
@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
@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/';
@btford
btford / chillax.md
Created October 30, 2014 06:59
Why you shouldn't worry so much about migrating with Angular

Several developers asked me about how difficult it will be to migrate Angular 1 to Angular 2. Angular 2 isn't done, so I legitimately have no idea how hard it will be. But there are a few high-level guiding principals in the design of Angular 1 that make adapting to changes like this fairly painless.

Angular 1 was designed so it would have a fairly minimal API surface. Let's look at controllers, since these are the meat of your app. Controllers are just functions that get passed other components as arguments:

MyController ($scope) {
  $scope.list = [];
  
  $scope.addItem = function (name) {
    $scope.list.push({
// The diff between the following two definitions has one line: `+c: 3,`:
var o1 = {
a: 1,
b: 2,
};
var o1 = {
a: 1,
b: 2,
c: 3,
};
@mgol
mgol / ie11-only.md
Last active May 11, 2023 15:50
How to easily not serve JS and/or CSS to IE<11

Here's how to make your site not load CSS and/or JS in IE older than 11:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=8,9,11">
        <title>Page title</title>
        <!--[if !IE]>-->
 
import template from './my-dummy.html';
import './my-dummy.scss';
const deps = new WeakMap();
class MyDummyController {
constructor($timeout, $q) {
'ngInject';
deps.set(this, {$timeout, $q});
}
@avdg
avdg / results.md
Last active May 24, 2016 22:46
Test262 es 6 results for UglifyJS harmony branch
  • Uglify checkout f63803e3e3753253721a4d7abbbe2ff46f11eecc (harmony)
  • Test262 checkout 28e707e367d438e52edb245067956df28d08ed25 (master)

process.versions:

{ http_parser: '2.7.0',
  node: '6.2.0',
  v8: '5.0.71.47',
 uv: '1.9.1',