Skip to content

Instantly share code, notes, and snippets.

% rspec -f doc
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
Rly::LRTable
attaches the lookahead symbols to grammar rules (PENDING: verify that values in LRItem#lookaheads are meaningful)
computes the READS() relation (p,A) READS (t,C)
computes the LR(0) sets of item function
computes the follow sets given a set of LR(0) items, a set of non-terminal transitions, a readset, and an include set
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 <[email protected]>
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 <[email protected]>
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, '[email protected]: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);
}