I've been trying to understand how to setup systems from
the ground up on Ubuntu. I just installed redis
onto
the box and here's how I did it and some things to look
out for.
To install:
use strict; | |
use warnings; | |
use Inline C => Config => LIBS => '-lsqlite3'; | |
use Inline C => <<'END'; | |
#include <sqlite3.h> | |
/* Not included in sqlite.h */ | |
#define SQLITE_PRIVATE static | |
#define SQLITE_ENABLE_FTS3 1 | |
#define UNUSED_PARAMETER(x) (void)(x) |
require 'em-proxy' | |
require 'http/parser' | |
require 'uuid' | |
# > ruby em-proxy-http.rb | |
# > curl --proxy localhost:9889 www.google.com | |
host = "0.0.0.0" | |
port = 9889 | |
puts "listening on #{host}:#{port}..." |
LINK_DETECTION_REGEX = /(([a-z]+:\/\/)?(([a-z0-9\-]+\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel|local|internal))(:[0-9]{1,5})?(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&]*)?)?(#[a-zA-Z0-9!$&'()*+.=-_~:@/?]*)?)(\s+|$)/gi | |
EMOJI_DIRECTORY = "/path/to/assets/emoji/20x20" | |
# Handlebars is presumed, but you could swap out | |
ESCAPE_EXPRESSION_FUNCTION = Handlebars.Utils.escapeExpression | |
MARKSAFE_FUNCTION = (str) -> new Handlebars.SafeString(str) | |
# Emoji unicode chars become images. |
class PostsController < ActionController::Base | |
def create | |
Post.create(post_params) | |
end | |
def update | |
Post.find(params[:id]).update_attributes!(post_params) | |
end | |
private |
% rake spec --trace | |
================================================================================ | |
A new version of RubyMotion is available. Run `sudo motion update' to upgrade. | |
================================================================================ | |
** Invoke spec (first_time) | |
** Execute spec | |
** Invoke simulator (first_time) | |
** Invoke build:simulator (first_time) | |
** Execute build:simulator |
class Transformer | |
def self.withName(name, class:klass, &block) | |
if block_given? | |
transformer = Transformer.new(&block) | |
transformer.build(name, transformedValueClass:klass) | |
end | |
end | |
def initialize(&dsl_code) | |
@transform = @reverse = nil |
#!/usr/bin/env macruby -wKU | |
framework 'Foundation' | |
module Dispatch | |
module Futuristic | |
def proxy | |
Class.new(BasicObject) do | |
def initialize(obj) | |
@obj = obj | |
end |
@interface SomeViewController () | |
// Declare some collection properties to hold the various updates we might get from the NSFetchedResultsControllerDelegate | |
@property (nonatomic, strong) NSMutableIndexSet *deletedSectionIndexes; | |
@property (nonatomic, strong) NSMutableIndexSet *insertedSectionIndexes; | |
@property (nonatomic, strong) NSMutableArray *deletedRowIndexPaths; | |
@property (nonatomic, strong) NSMutableArray *insertedRowIndexPaths; | |
@property (nonatomic, strong) NSMutableArray *updatedRowIndexPaths; | |
@end |