Skip to content

Instantly share code, notes, and snippets.

@buk
buk / Express
Created February 18, 2013 20:03
After the installation of Express.js the command 'express' to create new applications is not available
➜ Code npm install -g express
npm http GET https://registry.npmjs.org/express
npm http 304 https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/connect/2.7.2
npm http GET https://registry.npmjs.org/commander/0.6.1
npm http GET https://registry.npmjs.org/range-parser/0.0.4
npm http GET https://registry.npmjs.org/mkdirp/0.3.3
npm http GET https://registry.npmjs.org/cookie/0.0.5
npm http GET https://registry.npmjs.org/buffer-crc32/0.1.1
npm http GET https://registry.npmjs.org/fresh/0.1.0
@buk
buk / gauges.html
Created November 28, 2012 08:10
The gauges html file
{% if site.gauges_tracking_id %}
<script type="text/javascript">
var _gauges = _gauges || [];
(function() {
var t = document.createElement('script');
t.type = 'text/javascript';
t.async = true;
t.id = 'gauges-tracker';
t.setAttribute('data-site-id', '{{ site.gauges_tracking_id }}');
t.src = '//secure.gaug.es/track.js';
@buk
buk / api_participant.rb
Created November 21, 2012 07:48
The Participant Model
class ApiParticipant
def self.fetch_participants(&block)
BubbleWrap::HTTP.get("http://jugendgruppe-backend.192.168.2.105.xip.io/participants.json") do |response|
if response.ok?
json = BubbleWrap::JSON.parse(response.body)
participants = json.map {|pj| Participant.from_json(pj["participant"])}
p "You are here: #{self.name}: #{participants}"
block.call(true, participants)
@buk
buk / participants.json
Created November 21, 2012 01:29
All the participants as a JSON String
[{"participant":{"allergy":"Lactose Intolerant","created_at":"2012-11-20T05:40:07Z","date_of_birth":"2007-10-06","emergency_number":"xxxxxxxxxx","first_name":"Sebastian","group":"St. Peter","health_insurance_card":true,"id":1,"last_name":"Bachmann","swimmer":true,"updated_at":"2012-11-20T05:40:07Z","vaccination_certificate":true}},{"participant":{"allergy":"Fructose Intolerant","created_at":"2012-11-20T05:41:17Z","date_of_birth":"2008-03-03","emergency_number":"xxxxxxxxxx","first_name":"Johannes ","group":"St. Johannes","health_insurance_card":true,"id":2,"last_name":"Bachmann","swimmer":true,"updated_at":"2012-11-20T05:41:17Z","vaccination_certificate":true}}]
@buk
buk / participants.json
Created November 17, 2012 22:00
JSON Output
[{"allergy":"Lactose Intolerant","created_at":"2012-11-16T23:59:10Z","date_of_birth":"2012-11-16","emergency_number":"004962535377","first_name":"Sebastian","group":"St. Peter","health_insurance_card":true,"id":1,"last_name":"Bachmann","swimmer":true,"updated_at":"2012-11-17T00:44:16Z","vaccination_certificate":false},{"allergy":"Xanax","created_at":"2012-11-17T09:50:27Z","date_of_birth":"2013-11-17","emergency_number":"004962531546","first_name":"Markus","group":"St. Martin","health_insurance_card":true,"id":2,"last_name":"Bauer","swimmer":true,"updated_at":"2012-11-17T09:50:27Z","vaccination_certificate":true},{"allergy":"None","created_at":"2012-11-17T09:51:28Z","date_of_birth":"2007-01-03","emergency_number":"004962531546","first_name":"Christian","group":"Heiliger Franz von Asisi","health_insurance_card":false,"id":3,"last_name":"Bauer","swimmer":true,"updated_at":"2012-11-17T09:51:28Z","vaccination_certificate":false}]
@buk
buk / ParticipantsViewController
Created November 17, 2012 21:35
Load JSON Values and pass them to a UITableView - Rubymotion
class ParticipantsTableViewController < UITableViewController
def viewDidLoad
super
BW::HTTP.get("http://jugendgruppe-backend.192.168.2.105.xip.io/participants.json") do |response|
json = BW::JSON.parse(response.body.to_str)
@posts = json["items"]
view.addSubview(@tableView)
end
@buk
buk / SettingsController
Created October 24, 2012 12:03
This is my formotion code
class SettingsController < Formotion::FormController
include SettingsForm
def init
form = get_settings_form
super.initWithForm(form)
end
end
require 'rubygems'
require 'ipa_reader'
require 'plist'
require 'builder'
ipa_file = IpaReader::IpaFile.new("AdhocServerTest.ipa")
puts name = "Name:#{ipa_file.name}"
title = "#{ipa_file.name}"
puts bundleId = "Bundle Identifier: #{ipa_file.bundle_identifier}"
puts version = "Version: #{ipa_file.version}"
@buk
buk / gist:3905630
Created October 17, 2012 13:52
create File
require 'rubygems'
require 'builder'
plist = File.open(title + '.plist', 'w') do |f|
end
def generate_plist_file
plist = Builder::XmlMarkup.new( :indent => 2 )
plist.instruct! :xml, :encoding => "UTF-8"
@buk
buk / plist error
Created October 9, 2012 13:19
error message in irb
1.9.3-p194 :001 > require 'plist'
/Users/sebastian/.rvm/gems/ruby-1.9.3-p194/gems/plist-3.1.7/lib/plist/generator.rb:221: warning: else without rescue is useless
SyntaxError: /Users/sebastian/.rvm/gems/ruby-1.9.3-p194/gems/plist-3.1.7/lib/plist/generator.rb:216: syntax error, unexpected tLABEL
when String, Symbol: 'string'
^
/Users/sebastian/.rvm/gems/ruby-1.9.3-p194/gems/plist-3.1.7/lib/plist/generator.rb:217: syntax error, unexpected keyword_when, expecting keyword_end
when Fixnum, Bignum, Integer: 'integer'
^
/Users/sebastian/.rvm/gems/ruby-1.9.3-p194/gems/plist-3.1.7/lib/plist/generator.rb:217: dynamic constant assignment
when Fixnum, Bignum, Integer: 'integer'