Skip to content

Instantly share code, notes, and snippets.

import Ember from 'ember';
import { computed, set } from '@ember/object';
import { A } from '@ember/array';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
init() {
this.set('data', [{value: '123'}]);
},
arrayComputed: computed('data.[].{value}', function() {
@nolman
nolman / controllers.application.js
Created April 7, 2019 23:47
define-property-observer
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import EmberObject, {
computed,
defineProperty,
observer
Anonymous UUID: 64214483-04C2-D54D-945D-DF85F4ED08AA
Tue May 31 19:25:56 2016
*** Panic Report ***
panic(cpu 0 caller 0xffffff800c9d255a): Kernel trap at 0xffffff800c9c4d61, type 14=page fault, registers:
CR0: 0x0000000080010033, CR2: 0x0000000000000018, CR3: 0x000000082efb510a, CR4: 0x00000000001627e0
RAX: 0x0000000000000200, RBX: 0x0000000000000018, RCX: 0xffffff804fa73000, RDX: 0x0000000000000080
RSP: 0xffffff93bf2f3e88, RBP: 0xffffff93bf2f3ea0, RSI: 0x00000000edde328a, RDI: 0x0000000000000018
R8: 0x0000700000317da8, R9: 0x0000700000317df7, R10: 0x0000000000000001, R11: 0x0000000000000202
@nolman
nolman / gist:6009317
Created July 16, 2013 14:37
openresty install
wget http://openresty.org/download/ngx_openresty-1.2.8.6.tar.gz
tar xzvf ngx_openresty-1.2.8.6.tar.gz
cd ngx_openresty-1.2.8.6
sudo apt-get install -y libreadline-dev libncurses5-dev libpcre3-dev libssl-dev perl make
make
make install
EM_TIMEOUT = 5
def run_reactor_until_finished(timeout = EM_TIMEOUT, &block)
run_test_reactor(true, timeout, &block)
end
def run_reactor(&block)
run_test_reactor(false, EM_TIMEOUT, &block)
end
require 'spec_helper'
require 'redis'
class SomeApi < Goliath::API
use Goliath::Rack::Params
def response(env)
[200, {}, '']
end
end
source :rubygems
# bundle && bundle exec rspec web_spec.rb # will not hang
#gem "goliath", :git => "[email protected]:postrank-labs/goliath.git", :ref => "a8e3cbb87602ea2ec39fc350842d42bece14df68"
# bundle && bundle exec rspec web_spec.rb will hang
gem "goliath", :git => "[email protected]:postrank-labs/goliath.git", :ref => "671be754e5ee63a3c1bc230d02c781fab7d3935b"
gem "em-http-request"
group :test do
# Eventually some non deterministic difference of signals received
missed signal @cont_count: 428 @usr2_count: 439
@nolman
nolman / async_io.rb
Created July 7, 2011 05:56
Async IO
require 'rubygems'
require 'eventmachine'
require 'em-http-request'
require 'fiber'
EventMachine.run do
http = EM::HttpRequest.new('http://www.google.com').get
begin
puts "Before"
http.callback {
<!DOCTYPE html>
<html>
<head>
<title>Craigslist google maps mashup</title>
<script type="text/javascript" src="javascripts/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
$(document).ready(function(){
var latlng = new google.maps.LatLng(-34.397, 150.644);
var reverse_geocoder = new google.maps.Geocoder();