Skip to content

Instantly share code, notes, and snippets.

@daniellevass
daniellevass / 0_sharing_data_apple_watch.md
Last active March 28, 2016 15:49
Sharing Data apple watch

Sharing Data between Apple Watch and iPhone Apps

Introduction

So we've had a look at how we can do a lot of things with the WatchKit SDK and making our own Apple Watch Apps, however the next thing to look at is how to communicate between the iPhone and Apple Watch app. To do this we'll have to create an App Group which is essentially a space which both apps can use which was brought in with the exetension framework.

Add Capabilities

The first thing we need to do is add "App Group" capabilities to both our iPhone app and Watch Extension targets.

@staltz
staltz / introrx.md
Last active June 29, 2024 15:58
The introduction to Reactive Programming you've been missing
class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
end
end
BCX::Application.routes.draw do
draw :api
draw :account
draw :session
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@chetan
chetan / yardoc_cheatsheet.md
Last active May 10, 2024 02:53
YARD cheatsheet
@lusis
lusis / gist:1047214
Created June 26, 2011 03:58 — forked from rowan-m/gist:1026918
update jenkins Updatecenter from CLI
$ java -jar jenkins-cli.jar -s http://localhost:9000 install-plugin findbugs
findbugs is neither a valid file, URL, nor a plugin artifact name in the update center
No update center data is retrieved yet from: http://updates.jenkins-ci.org/update-center.json
findbugs looks like a short plugin name. Did you mean 'null'?
# Specifying a full URL works!
$ java -jar jenkins-cli.jar -s http://localhost:9020 install-plugin http://updates.jenkins-ci.org/download/plugins/AdaptivePlugin/0.1/AdaptivePlugin.hpi
# Get the update center ourself
@a-chernykh
a-chernykh / application_controller.rb
Created June 22, 2011 19:43
devise force https for sign in and sign up routes
class ApplicationController < ActionController::Base
before_filter :ensure_proper_protocol
protected
def ssl_allowed_action?
(params[:controller] == 'users/sessions' && ['new', 'create'].include?(params[:action])) ||
(params[:controller] == 'users/registrations' && ['new', 'create', 'edit', 'update'].include?(params[:action])) ||
(params[:controller] == 'users/omniauth_callbacks')
end
@banker
banker / basics.rb
Created January 26, 2011 19:42
Files used in a presentation on MongoDB and Ruby
require 'rubygems'
require 'mongo'
@con = Mongo::Connection.new
# Instance of Mongo::DB
@db = @con['webinar']
# Instance of Mongo::Collection
@col = @db['users']
@calvincorreli
calvincorreli / exceptional_for_delayed_job.rb
Created November 24, 2010 11:02
Integrating Exceptional with https://github.com/collectiveidea/delayed_job - put this in config/initializers/
if !Exceptional::Config.api_key.nil? && Rails.env == 'production'
begin
class Delayed::Worker
def handle_failed_job_with_exceptional(job, error)
Exceptional.handle(error, "Delayed::Job #{self.name}")
handle_failed_job_without_exceptional(job, error)
Exceptional.context.clear!
end
alias_method_chain :handle_failed_job, :exceptional
Exceptional.logger.info "Lars Pind's custom DJ integration enabled"
## /config/initializers/dynamic_job.rb
require 'heroku'
# base class for all jobs that you wish to automatically scale and go down in Heroku
class DynamicJob
#set a cap on maximum number of users ever - just in case.
MAX_CONCURRENT_WORKERS = 100
def initialize