This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[serviceProfile createCharacteristicWithUUID:<#UUID#> | |
name:<#name#> | |
andProfile:^(BlueCapCharacteristicProfile* characteristicProfile) { | |
characteristicProfile.properties = CBCharacteristicPropertyRead | CBCharacteristicPropertyWrite; | |
[characteristicProfile serializeObject:^NSData*(id data) { | |
return nil; | |
}]; | |
[characteristicProfile afterDiscovered:^(BlueCapCharacteristic* chararacteristic) { | |
}]; | |
[characteristicProfile deserializeData:^NSDictionary*(NSData* data) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <EEPROM.h> | |
#include <Arduino.h> | |
#include "log.h" | |
template <class T> class EEPROMObject { | |
public: | |
EEPROMObject(uint16_t _offset, uint8_t _maxObjects) : offset(_offset), maxObjects(_maxObjects){}; | |
uint16_t create(uint8_t& index, const T& value); | |
uint16_t update(uint8_t index, const T& value); | |
uint16_t read(uint8_t index, T& value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns climbing | |
(:require [clojure.string :as string]) | |
) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; part a ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; Each mountain block has 2 children it follows that for a mountain of size n | |
; the total paths will equal total number of block sequences from top to base | |
; taking one from each row which is given by p=2^(n-1) | |
(defn simple-path-count |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class Notify { | |
class func resetEventCount() { | |
eventCount = 0; | |
UIApplication.sharedApplication().applicationIconBadgeNumber = 0 | |
} | |
class func withMessage(message:String) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########################################################################################################## | |
require 'rubygems' | |
require "#{File.dirname(__FILE__)}/../../lib/agent_xmpp" | |
########################################################################################################## | |
# before filters | |
#......................................................................................................... | |
# only online contacts can send command messages | |
before :command => :all do | |
jid = params[:from] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xmpp_pubsub_messages.xml | |
*** get user disc#info | |
<iq to='noone@somewhere.com' id='disco1' type='get'> | |
<query xmlns='http://jabber.org/protocol/disco#info'/> | |
</iq> | |
*** create user@somewhere.com pubsub root node (sent from account user@somewhere.com) | |
<iq id='29293' to='pubsub.somewhere.com' type='set' xmlns='jabber:client'> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'fog' | |
config = YAML.load(File.read(ARGV[0])) | |
volumes_to_snap = YAML.load(File.read(ARGV[1])) | |
time = Time.now | |
puts "\nCreating snaps #{time.to_s}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def symbolize_keys!(thing) | |
case thing | |
when Array | |
thing.each{|v| symbolize_keys!(v)} | |
when Hash | |
thing.symbolize_keys! | |
thing.values.each{|v| symbolize_keys!(v)} | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface NSArray (Extensions) | |
- (NSArray *)mapObjectsUsingBlock:(id (^)(id obj, NSUInteger idx))block; | |
@end | |
@implementation NSArray (Extensions) | |
- (NSArray *)mapObjectsUsingBlock:(id (^)(id obj, NSUInteger idx))block { | |
NSMutableArray *result = [NSMutableArray arrayWithCapacity:[self count]]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <objc/runtime.h> | |
@interface NSObject (Extensions) | |
- (NSString*)className; | |
@end | |
@implementation NSObject (Extensions) |
OlderNewer