The codecademy
This file contains hidden or 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
%% Old defaults order dependent | |
function config_old( rx1, rx2 ) | |
if nargin < 2 rx2 = 0; end | |
end | |
%% newer style easy to refactor, no order dependence. | |
function config_new( rx1, rx2 ) | |
if not( exist('rx2') ) rx2 = 0; end | |
end |
This file contains hidden or 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
%% Run simulation | |
sim_length = samples/fs_in; | |
% [answer.t, answer.x, answer.y] = sim( 'testharness', sim_length ); | |
paramNameValStruct.StartTime = '0.0' ; | |
paramNameValStruct.StopTime = num2str(sim_length) ; | |
sim_result = sim( 'testharness', paramNameValStruct); | |
%% Get the results |
This file contains hidden or 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
## Idea of using $? from: | |
##http://tech.natemurray.com/2007/03/ruby-shell-commands.html | |
namespace :deploy do | |
## name and version from | |
## https://github.com/mojombo/rakegem | |
def name | |
@name ||= Dir['*.gemspec'].first.split('.').first | |
end |
This file contains hidden or 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 | |
require 'maruku' | |
## TODO or maybe not, we currently cut styling -- == underlining if it is on the line after the cut off length. | |
# would you want a snippet ending with a heading though? | |
def maruku_html_snippet(markdown,lines=-1 ) | |
if lines == -1 | |
markdown_temp = markdown | |
else |
class String
def to_bool
return true if self == true || self =~ (/(true|t|yes|y|1)$/i)
return false if self == false || self.blank? || self =~ (/(false|f|no|n|0)$/i)
raise ArgumentError.new("invalid value for Boolean: \"#{self}\"")
end
end
This file contains hidden or 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 sqm_to_sqft(num) | |
num*10.763910 | |
end | |
# http://www.espc.com/properties/details.aspx?pid=315620&sid=25446441807 | |
data = [ | |
[3.75, 3.32], | |
[2.95, 2.87], | |
[3.78, 2.47], | |
[1.88, 1.45], |
Install Gems:
gem install cowsay rainbow_say
Command line:
cowsay boo | rainbow_say
This file contains hidden or 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
Generic Content |
This file contains hidden or 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
%% Trial FFT | |
% http://www.mathworks.co.uk/help/matlab/math/fast-fourier-transform-fft.html | |
fs = 48000; % Sample Rate | |
n = 4096; % Power of 2 number of samples/ length of FFT | |
% Get/Generate data | |
t = 0:1/fs:(n-1)/fs; % n/fs sec sample | |
x = (1.3)*sin(2*pi*1500*t) ... % 1.5k Hz component | |
+ (1.7)*sin(2*pi*4000*(t-2)) ... % 4.0k Hz component |