Skip to content

Instantly share code, notes, and snippets.

View Codercise's full-sized avatar

Nick Hayden Codercise

View GitHub Profile
i = 0
hugeNumber = 5096498213401
while i<hugeNumber
i += 1
j = i + i
k = j * j
x = i + i * j *j
y = j * i + i * x
z = i + j + k + x + y * i * j * k * x * y
puts "#{i} #{j} #{k} #{x} #{y} #{z}"
@Codercise
Codercise / loop result
Created April 4, 2012 23:13
seemingly endless loop died :(
38502743941027675829248281594812432091994853894962484675148719952799924
238261174 476522348 227073548143433104 54102810164999891987765270 12890599066612
008088414920938343532 2317763512523371358056778295116052527610220742268789096257
52595684099789952897753990042688861577825096456468212370908466220865736
238261175 476522350 227073550049522500 54102810846220539277198675 12890599283023
250110855782038704375 2317763658440782598851039980212511959476291316262390563078
16285922435516161433286021095658140018499471931550206208883689650879700
238261176 476522352 227073551955611904 54102811527441192284900280 12890599499434
494858179243733335232 2317763804358202413613835938250301236065654730204987677049
60905409239123163362518423375171874763358458245409642557195862506133472
def test_parallel_assignments_with_splat_operator
first_name, *last_name = "FILL ME IN", "FILL ME IN"
assert_equal __, first_name
assert_equal __, last_name
end
The answers you seek...
<"FILL ME IN"> expected but was <["FILL ME IN"]>.
Please meditate on the following code:
#logosAndTitle {
width:1000px;
}
#logoList ul, #logoList li{
display: inline;
margin: 0;
padding: 0;
color: #339;
font-weight: bold;
width:1000px;
@Codercise
Codercise / gist:2722696
Created May 18, 2012 01:58
functional requirements
Functional Requirements
• CMS (Add/edit content and pages. Blog page with RSS) preferably open source (WordPress, Joomla!, Drupal etc).
• Accessible/Conforms to legislation.
• Custom styles, either through being able to edit the style sheet directly or by adding styles through some sort of interface.
• Multiple user accounts with different levels of permissions.
• Plugins/Widgets available (desired)
• jQuery should be used for interactive elements (no Flash)
[2012-05-19 15:46:28] make
CC = /usr/bin/gcc-4.2
LD = ld
LDSHARED = /usr/bin/gcc-4.2 -dynamiclib
CFLAGS = -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=shorten-64-to-32 -Werror=implicit-function-declaration -fno-common -pipe
XCFLAGS = -include ruby/config.h -include ruby/missing.h -fvisibility=hidden -DRUBY_EXPORT
CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I. -I.ext/include/x86_64-darwin10.8.0 -I./include -I.
DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace -install_name /Users/Haydos/.rvm/rubies/ruby-1.9.3-p194/lib/libruby.1.9.1.dylib -current_version 1.9.1 -compatibility_version 1.9.1 -Wl,-unexported_symbol,_Init_* -Wl,-unexported_symbol,*_threadptr_* -Wl,-u,_objc_msgSend
SOLIBS =
compiling time.c
@Codercise
Codercise / gist:2785443
Created May 25, 2012 02:41
Website Requirements
Functional Requirements
• CMS (Add/edit content and pages. Blog page with RSS.)
• WYSIWYG editor with administrator definable styles for font, size style, colour etc.
• Add HTML elements from edit view (design/code view)
• Accessible/Conforms to legislation.
• Custom styles, either through being able to edit the style sheet directly or by adding styles through some sort of interface.
• Multiple user accounts with different levels of permissions.
• Workflow approvals can be set on content where applicable.
• Audit trail of all changes to pages and ability to revert to previous versions.
• Granular permissions can be set on a per site or per page basis
#################################
FIRST VARIATION (only removes the first tag)
#################################
def remove_tags(html):
start_tag = '>'
end_tag = '</'
find_stag = html.find(start_tag)
find_etag = html.find(end_tag)
if start_tag == -1:
return None
# Question 7: Find and Replace
# For this question you need to define two procedures:
# make_converter(match, replacement)
# Takes as input two strings and returns a converter. It doesn't have
# to make a specific type of thing. Itcan
# return anything you would find useful in apply_converter.
# apply_converter(converter, string)
# Takes as input a converter (produced by create_converter), and
# a string, and returns the result of applying the converter to the
# Question 4: Remove Tags
# When we add our words to the index, we don't really want to include
# html tags such as <body>, <head>, <table>, <a href="..."> and so on.
# Write a procedure, remove_tags, that takes as input a string and returns
# a list of words, in order, with the tags removed. Tags are defined to be
# strings surrounded by < >. Words are separated by whitespace or tags.
# You may assume the input does not include any unclosed tags, that is,
# there will be no '<' without a following '>'.