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
dscl localhost -list /Local/Default/Hosts |
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
svn remove log/* | |
svn propset svn:ignore "*.log" log/ | |
svn remove tmp/* | |
svn propset svn:ignore "*" tmp/ |
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
#!/usr/bin/ruby | |
require 'yaml' | |
require 'cgi' | |
SVNLOOK = '/usr/bin/svnlook' | |
CURL = '/usr/bin/curl' | |
LOG_FILE = '/tmp/svn-hooks.log' | |
# Configuration | |
# Set your basecamp url, username, password and project id here. |
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
Enter ".help" for instructions | |
sqlite> CREATE TABLE data (name STRING, address STRING, salary INTEGER); | |
sqlite> .mode csv | |
sqlite> .import out.csv data | |
sqlite> .quit |
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
module ActionView | |
module Helpers | |
module TextHelper | |
def truncate(text, length = 30, truncate_string = "...") | |
if text.nil? then return end | |
l = length - truncate_string.chars.to_a.size | |
(text.chars.to_a.size > length ? text.chars.to_a[0...l].join + truncate_string : text).to_s | |
end | |
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
class Photo < ActiveRecord::Base | |
belongs_to :photographable, :polymorphic => true | |
has_attached_file :source, | |
:styles => { :normal => ['112x112^', :png] }, | |
:default_style => :normal, | |
:path => ":rails_root/public/assets/:class/:attachment/:id/:style/:basename.:extension", | |
:url => "/assets/:class/:attachment/:id/:style/:basename.:extension" | |
acts_as_list :scope => :photographable | |
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
File.open(asm_filename, 'r') do |infile| | |
outfile = File.open(hack_filename, 'w') do |outfile| | |
assembler = Assembler.new(infile, outfile) | |
assembler.go! | |
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
// WARNING: my java is rusty, so this is conceptual only. [yjb] | |
import java.util.Hashtable; | |
public class SymbolTable { | |
HashTable symbols; | |
public SymbolTable() { | |
symbols = new Hashtable(100); |
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
# | |
# Begin driver script. | |
# | |
# Expects only one argument, the .vm filename or directory | |
def args_valid? | |
if ARGV.size == 1 && (File.extname(ARGV[0]) == '.vm' || File.directory?(ARGV[0])) | |
true | |
else | |
false |
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 Parser | |
# Gets ready to parse the input file | |
def initialize(filename) | |
generate_command_array(filename) # | |
@index = 0 | |
end | |
# ... | |