Skip to content

Instantly share code, notes, and snippets.

Rly::Lex
Simple Lexer
should have a list of defined tokens
should output tokens one by one
Error handling
raises an error, if there are no suitable tokens
calls an error function if it is available, which can skip a token
raises an error, if there is no possible tokens defined
calls an error function if it is available, which returns a fixed token
Block-based Token Lexer
From 520d5d472d5e13ef1f68c732a748307db753fece Mon Sep 17 00:00:00 2001
From: Vladimir Pouzanov <farcaller@gmail.com>
Date: Mon, 28 May 2012 23:24:51 +0300
Subject: [PATCH] Resolve gem name internally
---
gem/specification.rb | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gem/specification.rb b/gem/specification.rb
From 59fc7da8ea7be513f452c82a808cbe125ea0dc96 Mon Sep 17 00:00:00 2001
From: Vladimir Pouzanov <farcaller@gmail.com>
Date: Fri, 25 May 2012 14:28:16 +0300
Subject: [PATCH 1/4] Added basic support for gems
---
gem.rb | 3 +++
gem/manager.rb | 15 +++++++++++++++
gem/motion_spec.rb | 18 ++++++++++++++++++
gem/specification.rb | 10 ++++++++++
Motion::Gem.build do |gem|
files = `git ls-files`.split($\)
gem.files = files.grep(%r{^lib/motion-redgreen/app/})
gem.spec_files = files.grep(%r{^lib/motion-redgreen/spec/})
gem.pre_build do |config|
redgreen_style_file = File.join(config.build_dir, 'redgreen_style_config.rb')
redgreen_style = config.redgreen_style || :focused
set :application, 'hackndev'
set :repository, 'git@github.com:hackndev/hackndev.git'
set :rails_env, 'production'
default_environment["RAILS_ENV"] = 'production'
set :normalize_asset_timestamps, false
set :scm, :git
set :git_enable_submodules, true
require 'socket'
require 'openssl'
module Apns
class ApnsConnection
def initialize(host, port, cert, key)
@host, @port, @cert, @key = host, port, cert, key
end
def connect
def fetchEpisodes(&block)
Dispatch::Queue.concurrent.async do
episodes = fetchFromRSS()
Dispatch::Queue.main.sync do
block.call(episodes)
end
end
end
def fetchEpisodes(&block)
NSLog("will fetch")
block.send(:retain)
Dispatch::Queue.concurrent.async do
data = NSString.stringWithContentsOfURL(NSURL.URLWithString(@feedUrl))
NSLog("loaded #{data.length} bytes")
rss = SimpleRSS.parse(data.to_s)
NSLog("loaded #{rss.items.length} items")
episodes = rss.items
# episodes = rss.items.map do |item|
- (void) setMaximumClusterLevel:(NSUInteger)value
{
if ( value > 419430 )
minimumClusterLevel = 419430;
else
minimumClusterLevel = round(value);
}
8628 PUSH {r4, r5, r6, r7, lr}
8632 ADD r7, sp, #12
8636 MOV r5, r1 ; arg2
8640 MOV r6, r0 ; arg1
8644 BL 0x2fec ; _objc_autoreleasePoolPush(arg1, arg2, arg3, arg4)
8648 MOVW r1, #4900 ; 4900
8652 MOVT r1, #0 ; 4900
8656 MOV r4, r0 ; 8644_ret1
8660 LDR r1, [pc, r1] ; load from 13568
8664 MOVW r0, #4960 ; 4960