Skip to content

Instantly share code, notes, and snippets.

@jadon1979
jadon1979 / file.cpp
Last active August 29, 2015 14:00 — forked from anonymous/gist:34b1409dc09f4836a40b
Make the changes discussed and it should work.
// Header file section
// Do you actually need stdafx or was it auto appended by VS?
//#include "stdafx.h"
#include<iostream>
#include<string>
//using namespace std;
//Funtion declaration
float Average (int *scores,int number) ;
void SortTestScores (int *scores,string *Names,int n) ;
@jadon1979
jadon1979 / investor.rb
Last active August 29, 2015 14:01
Spin Off of Google code jam Cookie clicker.
class Investor
def initialize(*args)
@c, @f, @x = args
@income = 2.0
@seconds = 0
end
def solve
return proper_seconds if (@x-@c)/@income < @x/(@income + @f)
@jadon1979
jadon1979 / guessing_game.rb
Last active August 29, 2015 14:01
Alpha test
class GuessingGame
attr_reader :total_tricks, :trick_config, :results
def initialize(trick_config)
@total_tricks = trick_config.slice!(0).to_i
@trick_config = trick_config
@results = []
end
@jadon1979
jadon1979 / fizz_buzz.rb
Created May 14, 2014 01:31
Code Tests: FizzBuzz solution
class FizzBuzz
attr_reader :output
def initialize(iterations = 100)
@output = (1..iterations).map { |i| fizz_buzz_test(i) }
end
def fizz_buzz_test(iteration)
case
@jadon1979
jadon1979 / simple_gen.rb
Last active August 29, 2015 14:01
Simple number generator for kid's math worksheets
def get_problems(total, max)
1.upto(total).map { |i| num_swap(rand(1..max), rand(1..max)) }
end
def num_swap(a, b)
return [a, b] if a > b
a = a+b
b = a-b
a = a-b
[a, b]
@jadon1979
jadon1979 / first_10_sequences.txt
Created June 6, 2014 09:15
Code Tests: Words Sequencer (sequencer.rb w/ sample output text files)
aaas
aarh
arhu
rhus
aaro
abab
bacu
balo
bbas
bbey
=begin
a
/ \
b c
/ / \
d e f
tree = ['a', ['b', 'd' ], ['c', 'e', 'f']]
@jadon1979
jadon1979 / block.rb
Created October 10, 2014 15:16
Another block example for you
def create_tag(tag, **args)
attributes = args.map { |k,v| " #{k}=\"#{v}\"" }.join
block = yield if block_given?
"<%s%s>%s</%s>" % [tag, attributes, block, tag]
end
// relation = ['Mother', 'Father', 'Son', 'Daughter', etc]
{
"name": "",
"relation": "",
"branch": [
"name": "",
"relation": "",
"branch": [
"name": "",
"relation": "",
tree = [
// branch eles
[
// spouse ele
[]
// spouse ele
[],
// spouse ele
[],
// branch eles