Skip to content

Instantly share code, notes, and snippets.

@cowboyd
cowboyd / product-search.hbs
Last active October 30, 2023 17:30 — forked from nelstrom/product-search.hbs
Messing around with Effection. Trying to create a scope, which is torn down with the component. And trying to run a task in that scope in response to user interaction.
<div>
<h1>Product search</h1>
<input {{on 'input' this.doSearch}} value={{this.query}} />
</div>
{{#with (async (ajax)) as |result|}}
{{#loading-overlay result.isPending}}
<button onclick={{action ajax.get '/products'}}>Load</button>
{{#with (list result) as |products|}}
{{#each (list products) as |item}}
{{item.title}}
<button {{action (action ajax.delete 'products/:id'
data=(hash id=item.id)
on-success=(action products.remove item))
on-error=(action notifications.error 'Could not delete item')
@cowboyd
cowboyd / gemconf.md
Last active May 24, 2016 16:28 — forked from elwayman02/gemconf-2016.md
GEMCONF Recap
+----------+
| | error(e)
+------| Error |<-------------------+-------------------------+
| | | | |
| +----------+ | |
| ^ | |
| | | |
| | | |
| |error(e) | |
| | | |
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
setText(text) {
console.log('text=', text);
this.attrs.updateMessageAtIndexPath(message, indexPath);
}
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
setText(text) {
this.attrs.updateMessageAtIndexPath(message, indexPath);
}
}
import Ember from 'ember';
export default Ember.Component.extend({
didRender() {
console.log('didRender');
console.log('pojo1', this.get('pojo1'));
console.log('pojo2', this.get('pojo2'));
console.log('pojo3', this.get('pojo3'));
}
require 'rubygems'
require 'v8'
def print_resources
rss = /\w*[ ]*#{Process.pid}[ ]*([.,\d]*)[ ]*([.,\d]*)[ ]*([\d]*)[ ]*([\d]*)/.match(`ps aux`)[4]
print "resources: #{rss.to_i/1024}MB\n"
end
print_resources
require 'jenkins/plugin/behavior'
module Jenkins
#
# Defines the equivalent of `hudson.Extension`
#
module Extension
extend Plugin::Behavior
module ClassMethods
@cowboyd
cowboyd / hacks.rb
Created November 15, 2011 21:26 — forked from metaskills/hacks.rb
Failed ImportProcessor
module Less
module Rails
class ImportProcessor < Tilt::Template
IMPORT_SCANNER = /@import\s*['"]([^'"]+)['"]\s*;/.freeze
def prepare
end
def evaluate(context, locals, &block)