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 User < ActiveRecord::Base | |
# new columns need to be added here to be writable through mass assignment | |
attr_accessible :email, :password, :password_confirmation # :username, | |
attr_accessor :password, :password_salt | |
before_save :prepare_password | |
#validates_presence_of :username | |
#validates_uniqueness_of :username, :email, :allow_blank => true | |
validates_uniqueness_of :email, :allow_blank => 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
#!/usr/bin/env bash | |
shift # strip the ruby version number | |
exec bash "$@" |
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
[:id, :tag, :type, :type_name].each { |y| | |
define_method "#{object_type}_#{y}" do |id| | |
@object_ids ||= {} | |
@object_ids[[$Ot.currentVariant, object_type]] ||= self.send("get_x_to_#{y}_hash", object_type.to_sym) | |
if [:type,:type_name].include?(y) | |
rv = @object_types[object_type][nr][serie.to_serie] | |
return (rv.is_a?(Fixnum) || rv.is_a?(String)) ? rv : nil | |
else | |
return @object_ids[object_type][id] | |
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
REM - WHAT'S THE TIME AND WHAT'S MY TEMP DIR | |
C:\Users\jamie.cook\AppData\Local\Temp>echo %TEMP% | |
D:\Temp | |
C:\Users\jamie.cook\AppData\Local\Temp>date /T | |
08:53 AM Fri 06/08/2012 | |
C:\Users\jamie.cook\AppData\Local\Temp>dir %TEMP%\tgc*.tmp tgc*.tmp | |
Volume in drive D is New Volume | |
Volume Serial Number is 0E92-4B73 |
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
" Lets get crontab editing working | |
if $VIM_CRONTAB == 'true' | |
set nobackup | |
set nowritebackup | |
endif |
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 'ml4r_test_case' | |
require 'ml4r/ml4r' | |
require 'ml4r/linear_regression' | |
class TestLinearRegression < Ml4rTestCase | |
DELTA = 0.0001 | |
def test_simple_regression | |
lr = Ml4r::OLSLinearRegression.new([[1.0],[2.0],[3.0]], [1.0, 2.0, 3.0]) | |
assert_kind_of(Ml4r::LinearRegression, lr) |
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
desc "Configure the time zone to Australia/Brisbane" | |
task :timezone, :roles => [:tempest_node, :ws_node, :grid_nodes] do | |
sudo "apt-get -qy install ntp" | |
sudo "rm -f /etc/localtime" | |
sudo "ln -s /usr/share/zoneinfo/Australia/Brisbane /etc/localtime" | |
sudo "sed -i \"`grep -n ^server /etc/ntp.conf | head -n 1 | awk -F : '{print $1}'` i\\server pool.ntp.org\" /etc/ntp.conf" | |
sudo "/etc/init.d/ntp restart" | |
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
mat1 = OtMatrix.new(2) | |
mat1[] = 55 | |
mat2 = OtMatrix.new(2) | |
mat2[] = 50 | |
mat2[1,1] = 99999 | |
p mat2 | |
mat_out = OtMatrix.new(2) |
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 AirportTripsReporter | |
def self.get_trips(iter, serie, pmtu, group_by, blend = false) | |
args = [iter, serie, pmtu, group_by, blend] | |
p args.inspect | |
@trips ||= {} | |
return @trips[args] if @trips[args] | |
@trips[args] = TripsExtractor.extract_trips(iter, serie, pmtu, group_by, blend) | |
@trips[args] | |
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
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
module Risk where | |
import Control.Monad.Random | |
import Control.Monad | |
import Data.List | |
------------------------------------------------------------ | |
-- Die values |
OlderNewer