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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>try erb</title> | |
</head> | |
<body> | |
<p> | |
<% 99.downto(96) do |number| %> | |
<%= number %> bottles of beer…<br> |
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
# Math Quiz by Jonathan J. Becker | |
# rewritten in an instructive Ruby style by Matt Mower <self@mattmower.com> | |
class Problem | |
attr_reader :arg1, :arg2 | |
def initialize( arg1, arg2 ) | |
if arg1 > arg2 | |
@arg1, @arg2 = arg1, arg2 |
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
ENV['RAILS_ENV'] = ENV['RACK_ENV'] | |
require "config/environment" | |
use Rails::Rack::LogTailer | |
use Rails::Rack::Static | |
run ActionController::Dispatcher.new |
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
# config.ru | |
require 'config/environment' | |
use Rails::Rack::LogTailer | |
use ActionDispatch::Static | |
run ActionController::Dispatcher.new | |
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
- (float *)generateSineWaveWithFrequency:(float)frequency amplitude:(float)amplitude atSampleRate:(int)sampleRate { | |
float *wave = malloc( sampleRate * sizeof( float ) ); | |
for( int n = 0; n < sampleRate; n++ ) { | |
wave[n] = sin( 2 * M_PI * ( (float)n / sampleRate ) * frequency ) * amplitude; | |
} | |
return wave; | |
} |
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
# Add a #domain method to URI to return the domain part of the hostname based on | |
# looking for valid IANA TLD names. | |
# | |
require 'open-uri' | |
module URI | |
def self.iana_tlds | |
@@iana_tlds ||= open( "http://data.iana.org/TLD/tlds-alpha-by-domain.txt" ).read.split(/\n/).reject { |s| s =~ /^#/ }.map { |d| d.upcase } |
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 -w | |
# by Matt Mower <self@mattmower.com> | |
# | |
# A script that monitors the 5-minute load average taking regular samples of top and iostat. | |
# When the 5m load goes above a threshold it sets off an alarm that gives regular terminal | |
# beeps. It also writes out the accumulated data from top & iostat to a log file. | |
# | |
class LoadAverageMonitor | |
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
02/12/2010 21:53:42 [0x0-0x546546].com.apple.Xcode[10430] osascript: couldn't save changes to script /Developer/Library/Xcode/Plug-ins/Xmod.pbplugin/Contents/Resources/Scripts/Xmod.scpt: Permission denied |
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
-- EVENTS I AM GENERATING -- | |
[Event no. 2] Triggered by WILL POST EVENT delegate method: | |
<PFEvent: 0x102f13860> | |
type: 11 (kCGEventKeyUp) | |
timestamp: 10904738161000 | |
position: {857, 661} | |
target PID: 1498 (name: Reaktor 5) | |
target PSN: 254014 (name: Reaktor 5) | |
source PID: 2597 (Freeman) |
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
Shaddam:Freeman matt$ rake --trace dmg | |
(in /Volumes/Corrino/matt/Projects/LucidMac/Freeman) | |
** Invoke dmg (first_time) | |
** Invoke build (first_time) | |
** Invoke build/Release/Freeman.app/Contents/Info.plist (first_time) | |
** Execute build/Release/Freeman.app/Contents/Info.plist | |
xcodebuild -configuration Release -target Freeman | |
=== BUILD NATIVE TARGET Freeman OF PROJECT Freeman WITH CONFIGURATION Release === | |
Check dependencies |