Skip to content

Instantly share code, notes, and snippets.

@rwjblue
rwjblue / run_loop_queues.md
Created October 12, 2013 21:24
Ember Run Loop Queues

The run loop in Ember starts off with three 'default' queues (sync, actions, destroy) setup here. A few additional queues (render and afterRender) are added by the ember-views package here. The ember-routing package also adds routerTransitions here.

You can see the list of run loop queues in your application along with their ordering by running Ember.run.queues in the console:

Ember.run.queues
["sync", "actions", "routerTransitions", "render", "afterRender", "destroy"]

Here is a little more detail about each queue (along with source references if available/known):

@rwjblue
rwjblue / jdbc_sample.rb
Created November 15, 2011 03:33
Convert JDBC ResultSet into Ruby Hash with JRuby
require 'java'
require 'jt400'
require 'date'
require 'bigdecimal'
java_import 'com.ibm.as400.access.AS400JDBCDriver'
def get_records
@connection ||= java.sql.DriverManager.get_connection("jdbc:as400://127.0.0.1/",'username','password')
rs = @connection.createStatement.executeQuery("SELECT * FROM RANDOM_TABLE")
@rwjblue
rwjblue / email.vb
Last active February 7, 2023 01:56
Generate and Send an Email with CDO from VB6
' From http://www.vbknowledgebase.com/?Id=21&Desc=Send-Email(E-Mail)-from-VB6-using-CDO
'****************************************************************
'* Purpose : To Send eMail
'*
'* Inputs : strRecipient(String) Recipient comma seperated
'* strSubject(String) Subject
'* strBody Body
'* colAttachments Collection of attachments
'* file paths.
@rwjblue
rwjblue / yaml_on_example.rb
Created September 25, 2013 13:57
YAML converts `on` and `off` to true and false. WTF?
s=<<-EOS
something: 'blah blah'
foo: 'bar'
on: 'WTF? true?'
off: "I don't even"
EOS
puts YAML.load(s)
#=> {"something"=>"blah blah", "foo"=>"bar", true=>"WTF? true?", false=>"I don't even"}
@rwjblue
rwjblue / application.controller.js
Created December 14, 2015 18:07 — forked from barneycarroll/application.controller.js
Can't access object values by dynamic key in Handlebars
import Ember from 'ember';
export default Ember.Controller.extend({
numbers:['1','2','3','4'],
letters:['a','b','c','d']
});
@rwjblue
rwjblue / inflector_test.rb
Last active January 23, 2022 02:14
Rails Inflector Test
Output:
'campu' != 'campus' -> regular singularization is preserved
@rwjblue
rwjblue / controllers.application.js
Created August 27, 2015 13:41
run helper on update
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
stuff: ['grapes', 'animals', 'cheese'],
selectedStuff: ['animals'],
actions: {
toggleThing(thing){
if(this.get('selectedStuff').contains(thing)){
console.log('remove ' + thing);
import Controller from '@ember/controller';
import { computed } from '@ember/object';
const values = [
0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100
];
export default Controller.extend({
sliderIndex: 1,
@rwjblue
rwjblue / rspec-uncommitted.sh
Last active May 17, 2021 15:18
Run rspec only on uncommited files. No more accidentally pushing a :focus tag to master!
rspec `git ls-files --modified --others spec`