Skip to content

Instantly share code, notes, and snippets.

@leoschweizer
leoschweizer / gdax-ltc.rb
Created Jan 16, 2018 — forked from Skeyelab/gdax-ltc.rb
GDAX Spot Price - LTC
View gdax-ltc.rb
require 'net/http'
require 'json'
require 'uri'
SCHEDULER.every '5s', allow_overlapping: false do
uri = URI.parse('https://api.coinbase.com/v2/prices/LTC-EUR/spot')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri.request_uri)
View btcprice.coffee
class Dashing.Btcprice extends Dashing.Widget
@accessor 'value', Dashing.AnimatedValue
@accessor 'btcprice', ->
if @get('value')
price = parseFloat(@get('value'))
View ethprice.coffee
class Dashing.Ethprice extends Dashing.Widget
@accessor 'value', Dashing.AnimatedValue
@accessor 'ethprice', ->
if @get('value')
price = parseFloat(@get('value'))
View keybase.md

Keybase proof

I hereby claim:

  • I am leoschweizer on github.
  • I am leoschweizer (https://keybase.io/leoschweizer) on keybase.
  • I have a public key ASA2lMRDCAbzeGKYw86iqDtn-nTuhxBzbYWw7pU4tRGbeQo

To claim this, I am signing this object:

@leoschweizer
leoschweizer / Heliograph-CreateAndUseClass.m
Created Jan 17, 2016
Creating and using a class (including instance variables and methods) at runtime with Heliograph
View Heliograph-CreateAndUseClass.m
#import <Heliograph/Heliograph.h>
static CGSize DummySizeImpl(NSObject *self, SEL cmd) {
HGInstanceVariableMirror *ivar = [[reflect(self) classMirror] instanceVariableNamed:@"_rectIvar"];
CGRect rect;
HGStructureValueMirror *value = [ivar valueIn:self];
[value readStructureValue:&rect];
return rect.size;
}
@leoschweizer
leoschweizer / Heliograph-LongestInheritanceChain.m
Last active Jan 16, 2016
Finding the class with the longest inheritance chain in your Objective-C runtime environment with Heliograph
View Heliograph-LongestInheritanceChain.m
#import <OpinionatedC/OpinionatedC.h>
#import <Heliograph/Heliograph.h>
NSArray *classes = [HGClassMirror allClasses];
HGClassMirror *longestInheritanceChain = [classes max:^NSNumber *(HGClassMirror *each) {
return @([[each allSuperclasses] count]);
}];
NSLog(@"%@ has %lu superclasses", longestInheritanceChain, [[longestInheritanceChain allSuperclasses] count]);
@leoschweizer
leoschweizer / Heliograph-MostInstancVariables.m
Created Jan 16, 2016
Finding the class with the most instance variables in your Objective-C runtime environment with Heliograph
View Heliograph-MostInstancVariables.m
#import <OpinionatedC/OpinionatedC.h>
#import <Heliograph/Heliograph.h>
NSArray *classes = [HGClassMirror allClasses];
HGClassMirror *mostInstanceVariables = [classes max:^NSNumber *(HGClassMirror *each) {
return @([[each instanceVariables] count]);
}];
NSLog(@"%@ has %lu instance Variables", mostInstanceVariables, (unsigned long)[[mostInstanceVariables instanceVariables] count]);
@leoschweizer
leoschweizer / Heliograph-LongestMethodName.m
Created Jan 16, 2016
Finding the longest method name in your Objective-C runtime environment with Heliograph
View Heliograph-LongestMethodName.m
#import <OpinionatedC/OpinionatedC.h>
#import <Heliograph/Heliograph.h>
NSArray *classes = [HGClassMirror allClasses];
NSMutableArray *methods = [NSMutableArray array];
[classes each:^(HGClassMirror *each) {
// add the instance methods of the reflected class
[methods addObjectsFromArray:[each methods]];
// add the class methods of the reflected class
[methods addObjectsFromArray:[[each classMirror] methods]];
@leoschweizer
leoschweizer / Heliograph-LongestClassName.m
Created Jan 16, 2016
Finding the longest class name in your Objective-C runtime environment with Heliograph
View Heliograph-LongestClassName.m
#import <OpinionatedC/OpinionatedC.h>
#import <Heliograph/Heliograph.h>
NSArray *classes = [HGClassMirror allClasses];
HGClassMirror *maxName = [classes max:^NSNumber *(HGClassMirror *each) {
return @(each.name.length);
}];
NSLog(@"%@", [maxName name]);
// => ___UIDocumentPickerDocumentCollectionViewControllerAccessibility_super