Skip to content

Instantly share code, notes, and snippets.

View samtsai's full-sized avatar
🏠
Working from home

Sam Tsai samtsai

🏠
Working from home
View GitHub Profile
@samtsai
samtsai / selection-command.js
Last active March 6, 2021 19:37 — forked from erquhart/selection-command.js
Text selection commands for Cypress.io
/**
* 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')
@samtsai
samtsai / components.my-component.js
Created June 14, 2016 21:29 — forked from jpadilla/components.my-component.js
Component Lifecycle Hooks
import Ember from 'ember';
export default Ember.Component.extend({
init(options) {
console.log('init', options);
},
didUpdateAttrs(options) {
console.log('didUpdateAttrs', options);
},
@samtsai
samtsai / components.my-component.js
Last active September 1, 2015 18:46 — forked from rwjblue/components.my-component.js
Set Bound Attr in `didInitAttrs`
import Ember from 'ember';
export default Ember.Component.extend({
didInitAttrs() {
this._super(...arguments);
var value = this.get('value');
if (value) {
console.log('initial value');
/* 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! [email protected]
*
* Note: this assumes you've set up login on your Firebase,
* only handles Google and Facebook for now.
*
@samtsai
samtsai / Premise.md
Created March 13, 2012 20:14 — forked from jswartwood/Premise.md
AE Code Golf #1

Fibonacci Sequence

Classics series

Print the Fibonacci series (the first 10 values) separated by spaces. If you've ever taken a Computer Science class, you should be all over this one.