Skip to content

Instantly share code, notes, and snippets.

View with-jquery.js
jQuery(($) => {
$("#menu-toggle").click((evt) => {
evt.preventDefault();
$('.menu-activable').toggleClass('menu-active');
return false;
});
});
View keybase.md

Keybase proof

I hereby claim:

  • I am rudyjahchan on github.
  • I am rudy (https://keybase.io/rudy) on keybase.
  • I have a public key ASBlzEffWUxHOm2z9XLUaj20HHPIhB9CN25nOVBQClN5Cwo

To claim this, I am signing this object:

@rudyjahchan
rudyjahchan / TimeHelper.swift
Last active Nov 2, 2016
A playground to get easy helpers for dates
View TimeHelper.swift
//: Playground - noun: a place where people can play
import Foundation
extension DateComponents {
static prefix func - (components: DateComponents) -> DateComponents {
var newComponents = DateComponents()
newComponents.calendar = components.calendar
newComponents.timeZone = components.timeZone
@rudyjahchan
rudyjahchan / Experiment1.swift
Last active Oct 27, 2016
Experiments in typing
View Experiment1.swift
//: Playground - noun: a place where people can play
import UIKit
protocol HasCreatedAtTimestamp {
var createdAt: Date { get }
func setCreatedAt(date: Date) -> Self
}
View testfactory.swift
//: Playground - noun: a place where people can play
import UIKit
typealias Properties = Dictionary<String,Any?>
struct TypeKey {
let type: Any.Type
}
@rudyjahchan
rudyjahchan / deadly.js
Created Jul 20, 2016
A-Frame Deadly Component
View deadly.js
import Component from '../core/component';
export default class Deadly extends Component {
init() {
this.el.addEventListener('collide', e => this.onCollision(e));
}
onCollision(event) {
event.detail.body.el.emit('death', event);
}
View C5RACAlmostFinalForm.m
RAC(self, 'titleLabel.text') =
[self.selectedRegion map:^NSString*(WTFRegion *region) {
return region.title;
}];
RACSignal *regionRect = [self.selectedRegion map:^NSValue*(WTFRegion *region) {
return [NSValue valueFromMKMapRect:region.rect];
}];
[self.mapView rac_liftSelector:@selector(setVisibleMapRect:animated:)
withSignals:regionRect, [RACSignal return:@(YES)], nil];
View C5RACLiftFetchAndAddAnnoations.m
RACSignal *annotations = [self rac_liftSelector: @selector(fetchAnnotationsForRegion:)
withSignals: selectedRegionSignal, nil];
[self.mapView rac_liftSelector:@selector(addAnnotations:)
withSignals:annotations, nil];
View C5RACLiftAddAnnotations.m
__weak id weakSelf = self;
RACSignal *annotations = [self.selectedRegion map:^NSArray*(WTFRegion *region) {
id strongSelf = self;
return [strongSelf fetchAnnotationsForRegion:region];
}];
[self.mapView rac_liftSelector:@selector(addAnnotations:)
withSignals:annotations, nil];
View C5RACLiftSetVisibleMapRect.m
RACSignal *regionRect = [self.selectedRegion map:^NSValue*(WTFRegion *region) {
return [NSValue valueFromMKMapRect:region.rect];
}];
[self.mapView rac_liftSelector:@selector(setVisibleMapRect:animated:)
withSignals:regionRect, [RACSignal return:@(YES)], nil];