This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'haml' | |
@template = File.read(ARGV[0]) | |
@engine = Haml::Engine.new(@template) | |
@template_scope = Object.new | |
@partials = {} | |
Dir.glob("./src/_*.haml").each do |f| | |
partial_name = f.sub(/_/, '') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task :update do | |
system("rsync -rv build/* freedrull@freedrool.us:/var/www/freedrool.us/") | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def assert_cache_works(key, procs) | |
#code that creates cache | |
procs[:cache].call | |
assert Rails.cache.exist?(key) | |
#code that should clear the cache | |
procs[:clear].call | |
assert !Rails.cache.exist?(key) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
char *tag(char *dest, char* tag, char* closing_tag){ | |
char *out = malloc(1024); | |
printf("dest:%s\n",dest); | |
out = strncat(out, tag, strlen(tag)); | |
out = strncat(out, dest, strlen(dest)); | |
out = strncat(out, closing_tag, strlen(closing_tag)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyJob | |
def initialize(blahblah) | |
@blahblah = blahblah | |
@logger ||= Logger.new(File.join(Rails.root, 'log', 'delayed_job.log')) | |
end | |
def perform | |
@logger.add Logger::INFO, "logging from delayed_job" | |
#do stuff | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'yaml' | |
class BlogArticle | |
SUMMARY_SEPARATOR="READMORE" | |
attr_reader :date, :title, :tags, :page | |
def initialize(file) | |
f = File.read(file) | |
y = YAML.load(f.split("---\n")[1]) | |
@title = y[:title] | |
@date = Date.parse y[:date] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Using rake (0.9.2.2) | |
Using activesupport (3.0.10) | |
Using builder (2.1.2) | |
Using i18n (0.5.0) | |
Using activemodel (3.0.10) | |
Using arel (2.0.10) | |
Using tzinfo (0.3.33) | |
Using activerecord (3.0.10) | |
Using aasm (3.0.4) | |
Using abstract (1.0.0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
class BlogArticle | |
def initialize(file) | |
f = File.read(file) | |
puts "the encoding: #{f.encoding}" | |
y = YAML.load(f.split("---\n")[1]) | |
end | |
# output: | |
# the encoding: US-ASCII |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FooJob < JobBase | |
@@model_name = Foo | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[2] pry(main)> b = Boo.new(2) | |
=> #<Boo:0x9deaa90 @stuff=2> | |
[3] pry(main)> b.blah | |
=> "thingsmorethings" |
OlderNewer