Skip to content

Instantly share code, notes, and snippets.

@jwoertink
jwoertink / xmpp.js
Created September 26, 2014 23:33
An example of using XMPP to do messaging
var Client = require('node-xmpp-client'),
ltx = require('node-xmpp-core').ltx;
var client = new Client({jid: '[email protected]', password: 'password'});
client.on('online', function(data) {
console.log('Connected as ' + data.jid.user + '@' + data.jid.domain + '/' + data.jid.resource)
var presence = new ltx.Element('presence', { type: 'available' }).c('show').t('chat');
client.send(presence);
});

Keybase proof

I hereby claim:

  • I am jwoertink on github.
  • I am jeremywoertink (https://keybase.io/jeremywoertink) on keybase.
  • I have a public key whose fingerprint is AF5E 8AEF 4CB8 6611 3037 C44C 8336 1F37 B055 1836

To claim this, I am signing this object:

class Thing
constructor: (obj)->
# do stuff with obj
obj # I want this returned
new_thing = new Thing(x: 1)
console.log(new_thing.x) # I want 1 but I get undefined
Tue Aug 12 2014 09:39:08 GMT-0700 (Pacific Daylight Time) | sip.ua | configuration parameters after validation: sip.js:36
Tue Aug 12 2014 09:39:08 GMT-0700 (Pacific Daylight Time) | sip.ua | · viaHost: "192.0.2.53" sip.js:36
Tue Aug 12 2014 09:39:08 GMT-0700 (Pacific Daylight Time) | sip.ua | · uri: sip:[email protected] sip.js:36
Tue Aug 12 2014 09:39:08 GMT-0700 (Pacific Daylight Time) | sip.ua | · wsServers: [{"ws_uri":"ws://172.16.1.56:8088/ws","sip_uri":"<sip:172.16.1.56:8088;transport=ws;lr>","weight":0,"status":0,"scheme":"WS"}] sip.js:36
Tue Aug 12 2014 09:39:08 GMT-0700 (Pacific Daylight Time) | sip.ua | · password: NOT SHOWN sip.js:36
Tue Aug 12 2014 09:39:08 GMT-0700 (Pacific Daylight Time) | sip.ua | · registerExpires: 600 sip.js:36
Tue Aug 12 2014 09:39:08 GMT-0700 (Pacific Daylight Time) | sip.ua | · register: true sip.js:36
Tue Aug 12 2014 09:39:08 GMT-0700 (Pacific Daylight Time) | sip.ua | · registrarServer: sip:172.16.1.56 sip.js:36
Tue Aug 12 2014 09:39:08 GMT-0700 (Pacific Daylight Time) |
Understanding Associations in rails
1. Take 2 models
2. Associate them
3. Ensure database has association columns needed
4. Scope routes
5. Use the scope in your controller
Example:
class Meat
@jwoertink
jwoertink / gist:ef3eed03621d73d92fb2
Created June 12, 2014 21:00
SASS error throwing segfault in ruby
Started GET "/404" for 127.0.0.1 at 2014-06-12 14:54:17 -0600
Processing by ErrorsController#not_found as HTML
Rendered errors/not_found.html.slim within layouts/public (0.1ms)
/Users/jeremy/.rvm/gems/ruby-2.1.2@my_app/gems/sass-3.2.19/lib/sass/util/subset_map.rb:74: [BUG] Segmentation fault at 0x007fa2185e3e90
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/CrashReporter
* /Library/Logs/CrashReporter
@jwoertink
jwoertink / gist:fae441b2324e4b705297
Last active August 29, 2015 14:02
Note: using Rails 4.1.1 and jquery 1.11.0
class ItemsController < StaffController
def index
@items = Item.do_stuff
render json: 'done'
end
end
#
# bash completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
# *) local and remote branch names
Process: JavaAppLauncher [13936]
Path: /Users/USER/Downloads/TreeEditor.app/Contents/MacOS/JavaAppLauncher
Identifier: iso.TreeEditor
Version: 1.0 (1)
Code Type: X86-64 (Native)
Parent Process: launchd [231]
Responsible: JavaAppLauncher [13936]
User ID: 501
Date/Time: 2014-05-01 09:28:54.550 -0700
describe Event::Connection do
describe 'after create', :focus do
it 'creates a new life cycle connection' do
org = create(:organization)
evt = create(:event)
connection = evt.connections.build connectable: org
LifeCycle::Connection.stub(:after_create).and_return(nil)
connection.save