Skip to content

Instantly share code, notes, and snippets.


Corey Smedstad smedstadc

  • United States
View GitHub Profile
View $.ajax progress event
function handleUploadProgress(event) {
function handleDownloadProress(event) {
function prepareXHR() {
View gist:f2743b419d216bb8f19b
xinput --set-prop "Logitech USB Laser Mouse" "Device Accel Velocity Scaling" 1
xinput --set-prop "Logitech USB Laser Mouse" "Device Accel Constant Deceleration" 1.0
View jsonp.js
function logIt(it) {
ajaxOptions = {
url: '',
dataType: 'jsonp',
jsonpCallback: 'logIt'
smedstadc / deborator.rb
Created Dec 11, 2015
Basic Ruby Decorator
View deborator.rb
class Decorator
# Uncomment for Rails
# include ActionView::Helpers::UrlHelper
attr_reader :decorated
def initialize(decorated)
@decorated = decorated
smedstadc / read_only_hash.rb
Created Apr 12, 2015
Read Only Ruby Hash Snippet
View read_only_hash.rb
# By extending a regular ruby hash with this module the hash will behave as if
# it were an immutable object. The brackets and fetch methods will return copies
# of values and the assignment method will raise an exception.
# Other methods that should be redefined for a truly immutable hash object.
# :delete, :delete_if, :reject!, :select!, :keep_if, :merge!, :update
module ReadOnlyHash
def [](key)
value = super(key)
value ? value.dup : default