Skip to content

Instantly share code, notes, and snippets.

View mgol's full-sized avatar

Michał Gołębiowski-Owczarek mgol

View GitHub Profile
@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",
@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]+?))?$/,
@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
@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({
@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
};

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 -
@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',
#!/usr/bin/node
const N = 1000000;
// 130 ms
(function() {
console.time('+=');
let a = '';
for (let i = 0; i < N; i++) {
a += 'x';
hooks.method = function() {
if (supportTestPasses()) {
delete hooks.method;
return;
}
hooks.method = function () {
// current hook code here
}
return hooks.method();
};