Skip to content

Instantly share code, notes, and snippets.

💭
Coding hard or hardly coding

Clark Nelson clarknelson

💭
Coding hard or hardly coding
Block or report user

Report or block clarknelson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:9e6004874fb0fe12322f
$(window).scroll(function(){
var top = $(window).scrollTop();
var offset = 130;
var trigger = top+offset;
var elements = $('h1, h2, li');
checkElements(trigger, elements);
});
View gist:d6e85a16a35db142002b
9 class DiceSet
10 :attr_accessor :values
11 def roll(set)
12 @values = set
13 end
14 end
---
irb
---
View gist:1ee58d6fb03e20763d40
36 in_ruby_version("mri") do
37 RubyConstant = "What is the sound of one hand clapping?"
38 def test_constants_become_symbols
39 all_symbols_as_strings = Symbol.all_symbols.map { |x| x.to_s }
40
41 assert_equal false, all_symbols_as_strings.include?(RubyConstant)
42 end
43 end
View gist:4c8ec378513356fb82a9
def test_hash_is_unordered
hash1 = { :one => "uno", :two => "dos" }
hash2 = { :two => "dos", :one => "uno" }
assert_equal false, hash1 == hash2
end
View gist:6789419
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int charpos(const char character, const char *char_set)
{
int counter;
int length = strlen(char_set);
printf("%c\n", character);
for (counter = 0; counter<length; counter++){
View gist:6789140
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int charpos(const char character, const char *char_set)
{
int counter;
int length = strlen(char_set);
for (counter = 0; counter<length; counter++){
if (char_set[counter] == character){
View gist:6786511
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char *interpret_set(const char *input_set)
{
int counter;
int length = strlen(input_set);
char output[100];
for(counter = 0; counter<length; counter++){
View gist:5986972
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
== CreateProducts: migrating =================================================
-- create_table(:products)
rake aborted!
An error has occurred, this and all later migrations canceled:
You can’t perform that action at this time.