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
function nearestLargest(ary, i) { | |
var finds = []; | |
ary.forEach(function (el, idx, ary) { | |
if (ary[idx] > ary[i]) | |
finds.push(el); | |
}); | |
return finds.sort()[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
function SimpleSymbols(str) { | |
if ( str.length == 0 || !str.match(/[a-zA-Z]/) ) | |
return false; | |
for ( var i = 0; i < str.length; i++ ) { | |
if ( str[i].match(/[a-zA-Z]/) ) { | |
var v = [str[i-1] == '+', str[i+1] == '+'].every(function (e, idx, ary) { | |
return ( e == true ); | |
}); | |
if ( v == false ) | |
return 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
require 'net/smtp' | |
list_of_messages = [] | |
File.readlines('new_titles.txt').each do |line| | |
list_of_messages << "Subject: #{line.strip!}\n\nYOU ARE ONE STINKY FILTHY WHORE!!! Have fun removing all the emails buddy lol" | |
end | |
smtp = Net::SMTP.new('smtp.gmail.com', 587) | |
smtp.enable_starttls |
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 FileHandler | |
def self.load_from_file(filename) | |
File.open(filename, "r") | |
end | |
end | |
class Card | |
attr_reader :keyword, :definition | |
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 FileManager | |
attr_reader :file, :file_name | |
def initialize(file_name) | |
@file_name = file_name | |
load_file | |
end | |
def load_file | |
@file = File.open(@file_name, "r") |
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
<?xml version="1.0" encoding="utf-8" ?> | |
<!-- SQL XML created by WWW SQL Designer, http://code.google.com/p/wwwsqldesigner/ --> | |
<!-- Active URL: http://socrates.devbootcamp.com/sql.html --> | |
<sql> | |
<datatypes db="mysql"> | |
<group label="Numeric" color="rgb(238,238,170)"> | |
<type label="Integer" length="0" sql="INTEGER" re="INT" quote=""/> | |
<type label="Decimal" length="1" sql="DECIMAL" re="DEC" quote=""/> | |
<type label="Single precision" length="0" sql="FLOAT" quote=""/> | |
<type label="Double precision" length="0" sql="DOUBLE" re="DOUBLE" quote=""/> |
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 Todo | |
def initialize(file_name) | |
@file_name = file_name | |
@tasks = [] | |
load_file | |
end | |
def load_file | |
@task_file = File.read(@file_name) | |
@task_file.each_line { |line| @tasks << $1.strip if line =~ /^\d+. (.*)/ } |
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 BankAccount | |
def initialize(customer_name, type, acct_number) | |
@customer_name = customer_name | |
@type = type | |
@acct_number = acct_number | |
end | |
def customer_name=(customer_name) | |
@customer_name = customer_name | |
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 binary_search(number, random_numbers) | |
middle = random_numbers.length / 2 | |
until random_numbers[middle] == number | |
if random_numbers[middle] < number | |
middle += random_numbers[middle..-1].length / 2 | |
end | |
if random_numbers[middle] > number | |
middle -= random_numbers[0..middle].length / 2 | |
end | |
end |