Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Sam Tsai samtsai

🏠
Working from home
View GitHub Profile
@samtsai
samtsai / selection-command.js
Last active Mar 10, 2020 — forked from erquhart/selection-command.js
Text selection commands for Cypress.io
View selection-command.js
/**
* Credits
* @Bkucera: https://github.com/cypress-io/cypress/issues/2839#issuecomment-447012818
* @Phrogz: https://stackoverflow.com/a/10730777/1556245
*
* 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
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
View components.my-component.js
import Ember from 'ember';
export default Ember.Component.extend({
init(options) {
console.log('init', options);
},
didUpdateAttrs(options) {
console.log('didUpdateAttrs', options);
},
@samtsai
samtsai / delete-orig.sh
Created Sep 14, 2015
Remove "*.orig" after git merge
View delete-orig.sh
find . -name '*.orig' -delete
@samtsai
samtsai / components.my-component.js
Last active Sep 1, 2015 — forked from rwjblue/components.my-component.js
Set Bound Attr in `didInitAttrs`
View components.my-component.js
import Ember from 'ember';
export default Ember.Component.extend({
didInitAttrs() {
this._super(...arguments);
var value = this.get('value');
if (value) {
console.log('initial value');
View initializer-session.js
/* Original source: https://gist.github.com/oskarrough/914653b03d886c015320
* Modified fork: https://gist.github.com/consideRatio/761c6286158e70feaed7
*
* Working authentication with
* Firebase 2.0.x + Ember.js 1.8.1 + Ember Data Canary + EmberFire 1.3.0 + Ember CLI
* works for me! oskar@rough.dk
*
* 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
samtsai / setup_launch_agents.sh
Created Mar 26, 2014
Setup launch agents (useful for automating brew installs and their startup script)
View setup_launch_agents.sh
# 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.