Skip to content

Instantly share code, notes, and snippets.

View objectiveSee's full-sized avatar

Danny Ricciotti objectiveSee

  • Starship Studios
View GitHub Profile
handleResponseReady: function(response) {
try {
if(AuthToken.isChanged(this.token)) {
this._response.setHeader('Set-Cookie', AuthCookie.cookieFromToken(this.token));
}
this._response.setHeader('Content-type', 'application/json');
this._response.end(JSON.stringify(response));
} catch(e) {
this.handleError(e);
}
@objectiveSee
objectiveSee / bar.m
Last active August 29, 2015 14:06
From Apple: https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/Blocks/Articles/bxUsing.html. You only need to make a copy when you expect the block to be used after destruction of the scope within which it was declared. Copying moves a block to the heap.
__weak EAFriendsListContacts *weakSelf = self;
phoneVerification.dismissBlock = ^(BOOL success, NSString *phoneNumber, NSString *verificationCode){
[button setEnabled:YES withSpinner:NO];
if (success) {
[[EAEffectManager sharedEffectManager] startEffect:EAEffectTypeConfettiApplause];
[weakSelf _refreshContactData];
}
};
@objectiveSee
objectiveSee / Block.h
Last active August 29, 2015 14:06
I would like the interface for Block.h to support any type of block, and leave the responsibility for know the return value and parameters of a block to Controller.m
- (void)addBlock:(genericBlock)blockName;
- (blockType)getBlock;
#import "DRBlocks.h"
@interface DRBlocks ()
@property (nonatomic) NSMutableDictionary *blocksHash;
@end
@implementation DRBlocks
- (instancetype)init
{
@objectiveSee
objectiveSee / ssh.pl
Last active August 29, 2015 14:14
usage: ./ssh.pl or ./ssh.pl <index of host>
#!/usr/bin/perl
use strict;
use warnings;
# Read SSH config
my $filename = '/Users/<your user>/.ssh/config';
open(my $fh, '<:encoding(UTF-8)', $filename)
or die "Could not open file '$filename' $!";
## EVILBASE %{TIMESTAMP_ISO8601:pickles} - %{LOGLEVEL:level}:
grok {
match => { "message" => "%{EVILBASE}%{GREEDYDATA}" }
}
date {
match => [ "pickles" , "ISO8601" ]
}
#include <Arduino.h>
#include "Relay.h"
// Relay is active low, so you need a 0 to turn it on.
#define RELAY_ON 0
#define RELAY_OFF 1
Relay::Relay( int whatPin )
{
// initialize variables
ArrayList<String> cardIds = new ArrayList<>();
for (CardView.CardInfo c : cardsToDiscard) {
cardIds.add(c.getId());
}
bindFragmentLifecycle(lifecycle(),
gameManager.discardCards(game.getGameId(), cardIds)).observeOn(
AndroidSchedulers.mainThread()).subscribe(new Action1<Long>() {
@Override public void call(JSON json, ERROR error) {
View view = getView();
if (view == null) return;
{
duck:true,
"french":"fries"
}
@objectiveSee
objectiveSee / curl.json
Created December 22, 2015 17:51
curl http://localhost:9200/_nodes/jvm?pretty.json
{
"cluster_name" : "elasticsearch",
"nodes" : {
"QbEzXa1MRoOoupjNELMwlw" : {
"name" : "Zzzax",
"transport_address" : "inet[/10.0.0.240:9300]",
"host" : "ip-10-0-0-240",
"ip" : "10.0.0.240",
"version" : "1.4.0",
"build" : "bc94bd8",