Skip to content

Instantly share code, notes, and snippets.

View davestevens's full-sized avatar

Dave Stevens davestevens

View GitHub Profile
@davestevens
davestevens / for_loops.js
Last active August 29, 2015 13:57
JS For Loops?
// Setup
var array = [];
for(var i = 0; i < 1000; ++i) { array.push(i); }
var totals = {};
var log = function (id, time) {
totals[id] = totals[id] ? totals[id] : [];
totals[id].push(time);
};
#!/usr/bin/env ruby
require "rubyXL"
require "pry"
require "json"
# define from input
@key_col = 0
@translation_col = 2
file = PATH_TO_FILE
<!DOCTYPE html>
<html>
<head>
<style>
.vertically_align {
width: 256px;
height: 256px;
overflow: hidden;
}
@davestevens
davestevens / client.rb
Last active August 29, 2015 14:06
OAuth2 with Refresh Token
require "oauth2"
require_relative "token"
module Api
class Client
def initialize(client_id:, client_secret:, endpoint:)
@client_id = client_id
@client_secret = client_secret
@endpoint = endpoint
end
@davestevens
davestevens / index.html
Created September 18, 2014 13:34
Scroll Issue in Chrome at 110% zoom
<!DOCTYPE html>
<html>
<head>
<title>Scroll Test</title>
<style>
.wrapper {
height: 40px;
width: 400px;
overflow: auto;
}
@davestevens
davestevens / inject_vs_each_with_object.rb
Created January 19, 2015 14:16
Inject vs. Each With Object
#!/usr/bin/env ruby
inputs = [[1,2,3], [2,4,6], [1,3,5]]
inject_output = inputs.inject([]) do |memo, input|
memo |= input
memo
end
each_with_object_output = inputs.each_with_object([]) do |input, memo|
@davestevens
davestevens / Gemfile
Created January 21, 2015 23:51
BCrypt Issue
source "https://rubygems.org"
gem "bcrypt"
@davestevens
davestevens / Controller.php
Created April 3, 2015 11:46
Displays all Database Queries in Laravel 5
<?php namespace App\Http\Controllers;
use Illuminate\Foundation\Bus\DispatchesCommands;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Log;
use DB;
abstract class Controller extends BaseController {
@davestevens
davestevens / replaceState.html
Created September 3, 2015 14:53
replaceState test
<!--
Opening this in the latest Chrome (Version 45.0.2454.85) results in an error
"Uncaught SecurityError: Failed to execute 'replaceState' on 'History'"
This has only just stated happening this afternoon and doesn't cause an issue on older versions of Chrome
-->
<!DOCTYPE html>
<html>
<head>
<title>Testing replaceState</title>
</head>
@davestevens
davestevens / facebookFontSize
Created November 3, 2010 11:02
change facebook wall font size to something larger.
/* change Facebook wall font size
/* copy this into the javaConsole in your browser with facebook open
and press enter */
/* in Chrome this is opened by View | Developer | JavaScript Console
choose 'Console' (furthest right tab) and paste all of this in */
/* in Safari this is a bit trickier, you need to enable hidden debug
menu, in Terminal enter:
defaults write com.apple.Safari IncludeDebugMenu 1
Then restart Safari, open with Develop | Start Debugging JavaScript