Skip to content

Instantly share code, notes, and snippets.

Working from home

Sam Tsai samtsai

Working from home
View GitHub Profile
samtsai / selection-command.js
Last active Mar 10, 2020 — forked from erquhart/selection-command.js
Text selection commands for
View selection-command.js
* Credits
* @Bkucera:
* @Phrogz:
* Usage
* ```
* // Types "foo" and then selects "fo"
* cy.get('input')
* .type('foo')
View components.child-component.js
import Ember from 'ember';
export default Ember.Component.extend({
logger: Ember.inject.service()
samtsai / asap.js
Last active Feb 21, 2017
As soon as possible - simple asynchronous script loading library
View asap.js
// ASAP Library
// use case
add omniture to registry
omniture tags are waiting to fire
asap loads omniture asynchronously
page waits for omniture to be ready
omniture loads
asap announces omniture is ready
import Ember from 'ember';
export default Ember.Component.extend({
init(options) {
console.log('init', options);
didUpdateAttrs(options) {
console.log('didUpdateAttrs', options);
samtsai /
Created Sep 14, 2015
Remove "*.orig" after git merge
find . -name '*.orig' -delete
samtsai /
Last active Sep 1, 2015 — forked from rwjblue/
Set Bound Attr in `didInitAttrs`
import Ember from 'ember';
export default Ember.Component.extend({
didInitAttrs() {
var value = this.get('value');
if (value) {
console.log('initial value');
View initializer-session.js
/* Original source:
* Modified fork:
* Working authentication with
* Firebase 2.0.x + Ember.js 1.8.1 + Ember Data Canary + EmberFire 1.3.0 + Ember CLI
* works for me!
* Note: this assumes you've set up login on your Firebase,
* only handles Google and Facebook for now.
View jsbin.bisedoca.css
.gold-standard {
background-color: #FFBC31;
.gold-standard .inner-ring {
background-color: #FFD700;
.badge-ribbon {
position: relative;
height: 100px;
width: 100px;
View Set permissions for npm
sudo chown -R `whoami` ~/.npm
sudo chown -R `whoami` /usr/local/lib/node_modules
samtsai /
Created Mar 26, 2014
Setup launch agents (useful for automating brew installs and their startup script)
# Set Up Launch Agent to Run On Startup
function set_launch_agent() {
# retrieve the dependency's prefix
DEP_PREFIX=$(brew --prefix ${1})
# make the user local LaunchAgents directory (skip if already exists)
mkdir -p ~/Library/LaunchAgents
# copy brew generated plist to LaunchAgent
cp $DEP_PREFIX/*${1}*.plist ~/Library/LaunchAgents/
# load the agent now
launchctl load -w ~/Library/LaunchAgents/*${1}*.plist
You can’t perform that action at this time.