Skip to content

Instantly share code, notes, and snippets.

View jeffbcross's full-sized avatar

Jeff Cross jeffbcross

  • Google
  • Mountain View, CA
View GitHub Profile
@jeffbcross
jeffbcross / rebase-merge.sh
Created July 28, 2015 16:17
How angular merges PRs
#See fetch_pr script https://gist.github.com/vojtajina/5538170
# fetch and checkout PR branch from "upstream" remote
fetch_pr 123
git fetch upstream
# Replay changes on top of master
git rebase upstream/master
# Replace upstream/master with this branch
git push upstream pr-123:master
@jeffbcross
jeffbcross / renderer.js
Created November 6, 2017 04:44
Temporary pre-rendering script
/**
* This is the process that actually loads and renders the app module.
* It needs to load node-specific polyfills.
*/
require('reflect-metadata');
/**
* Set of core-js polyfills borrowed from Angular CLI
*/
require('reflect-metadata');
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
@jeffbcross
jeffbcross / trello-labeler.js
Last active July 18, 2016 22:36
Script to add a label to all cards in a trello board
/**
* Step 1: Create a named label
* Step 2: Open board
* Step 3: Open devtools console
* Step 4: Copy and paste this whole gist into console
* Step 5: Create an array of all cards to be renamed. For all cards: var allCards = Array.prototype.slice.call(document.querySelectorAll('.list-card'))
* Step 6: call addLabelToCards with the list of nodes as first argument, label name as 2nd argument: addLabelToCards(allCards, 'work')
**/
function addLabelToCards(cards, labelName) {
@jeffbcross
jeffbcross / gist:7882524
Created December 9, 2013 22:51
angular-sites/test.sh
#!/bin/bash
./node_modules/.bin/webdriver-manager update
./node_modules/.bin/webdriver-manager start
# ^ need to wait 5s and continue with running other scripts,
# then kill the process
./node_modules/.bin/protractor protractorConf.js
code1=$?
echo "code1"
echo $code1
"format register";
System.register("rxjs/util/noop", [], true, function(require, exports, module) {
var global = System.global,
__define = global.define;
global.define = undefined;
function noop() {}
exports.noop = noop;
global.define = __define;
return module.exports;
});
@jeffbcross
jeffbcross / gist:4049899
Created November 10, 2012 04:29
Jitsu Deploy Fail
info: Creating snapshot 0.0.0-4
info Uploading: [=============================] 99%
info: Updating app nko3-deployd
info: Activating snapshot 0.0.0-4 for nko3-deployd
info: Starting app nko3-deployd
error: Error running command deploy
error: Nodejitsu Error (500): Internal Server Error
error: There was an error while attempting to deploy the app
error:
error: Rackspace Error (404): Item not found
#Create a new git branch based on latest upstream/master
function freshbranch () {
git fetch upstream
git checkout -b $1 upstream/master
}
<div>
<button (click)="login()" *ng-if="!auth | async">Login</button>
<span *ng-if="auth | async">
Welcome, {{auth | async.github.displayName}}!
</span>
</div>
//@vsavkin did most of the work
//Angular 2 directive to allow setting a local variable from within a template.
//Usage example with an "auth" observable, whose unwrapped value gets set to "unwrapped":
/*
<span *assign-local="#unwrapped to auth | async">
<button (click)="login()" *ng-if="!unwrapped">Login</button>
</span>
*/
import {
Directive,
@jeffbcross
jeffbcross / gist:5c1cf63ebece067f01c2
Created March 19, 2015 23:56
advanced algorithm to create a full-page h1 for each unique character in a string. for printing and tracing letters.
<!DOCTYPE html>
<html>
<head>
<title></title>
<link href='http://fonts.googleapis.com/css?family=Mouse+Memoirs' rel='stylesheet' type='text/css'>
<style>
body {
height: 792pt;
margin: 0;
padding: 0;