Skip to content

Instantly share code, notes, and snippets.

View blurredbits's full-sized avatar

Mark Morris blurredbits

View GitHub Profile
@blurredbits
blurredbits / gist:4106586
Created November 18, 2012 18:07 — forked from padolsey/gist:527683
JavaScript: Detect IE
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@blurredbits
blurredbits / zoo.js
Last active December 18, 2015 11:09 — forked from dbc-challenges/zoo.js
Didn't get this one - not working.
//------------------------------------------------------------------------------------------------------------------
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here.
//------------------------------------------------------------------------------------------------------------------
Zoo = {
init: function(animals) {
Zoo = new Array(animals);
}
};
@blurredbits
blurredbits / index.html
Last active December 18, 2015 11:18 — forked from dbc-challenges/index.html
DBC Phase 2 Practice Assessment Part 3
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css">
</head>
@blurredbits
blurredbits / heroku_export.md
Last active January 3, 2021 21:16
Import/exporting database info from Heroku

Importing/Exporting a Postgres DB from Heroku

In the following scenario, we have the following apps on the Heroku server:

  • Staging Server: staging-stackoverfluff
  • Production Server: stackoverfluff

In addition, each developer has a local development environment.

The goal is to move production data over to the staging server, and also provide production data to each of the developers. Here's what we will do.

@blurredbits
blurredbits / stakeout_solution.md
Last active December 20, 2015 00:29
Stakeout Solution

#Stakeout

Congratulations! You are the new elite hacker in a group of villainous ne'er-do-wells.

Luckily this group is more saavy than your last band of ruffians, and they are looking to software (and you) to improve their take. The con man for the team, has gone door-to-door down each street posing as a termite inspector so he could covertly total the valuable goods in each house. Normally the gang would just rob all the valuable homes, but there's a catch! Whenever a house is robbed in this wealthy neighborhood, the police watch it and the neighboring houses for months.

# This is a simple refactoring exercise.
#
# What to do?
#
# 1. Look at the code of the class CorrectAnswerBehavior
# 2. Try to see what it does by running `ruby refactoring_example.rb`
# 3. Record characterisation tests by running `ruby refactoring_example.rb --record`
# 4. Make the code beautiful;)
# 5. You are allowed to modify only the code between markers (REFACTORING START/REFACTORING END).
# 6. Test must pass! You can run them with command `ruby refactoring_example.rb --test`
@blurredbits
blurredbits / Roman Numeral
Created March 13, 2014 02:01
Roman Numeral Generator - J. Weirich edition.
puts "Please enter a number you would like to convert to a roman numeral"
num = gets.chomp.to_i
def to_roman(num)
results = ""
digits = [
[1000, "M"],
[900, "CM"],
[500, "D"],
@blurredbits
blurredbits / guessing_game
Created March 13, 2014 02:55
Guessing Game
puts "Let's play a guessing game. "
puts "I'll pick a number from 1 to 20. You try to guess it."
puts "Please enter a number: "
answer = 1 + rand(19)
number_of_guesses = 0
begin
guess = gets.chomp.to_i
if guess < answer
@blurredbits
blurredbits / student.js
Created January 3, 2015 04:10
JS Group Week #1
validate('first_name', 'email', 'dream', 'password', 'password_confirm', function(value) {
if (this.is_empty(value)) {
return "Cannot be empty";
}
return true;
})
validate('form', function(elements) {
if (elements['first_name'].value == elements['last_name'].value) {

Keybase proof

I hereby claim:

  • I am blurredbits on github.
  • I am blurredbits (https://keybase.io/blurredbits) on keybase.
  • I have a public key whose fingerprint is E089 8BC5 353D 1E11 4AFB DF15 AE8B 21F9 6723 91E2

To claim this, I am signing this object: