Skip to content

Instantly share code, notes, and snippets.

View smedstadc's full-sized avatar

Corey Smedstad smedstadc

  • United States
View GitHub Profile
@smedstadc
smedstadc / gist:7036f464e1f69278fe362449aab8a646
Created July 24, 2023 15:33
wicked pdf workaround for fedora
WickedPdf.config ||= {}
WickedPdf.config.merge!({})
if Rails.env.development? && ENV["WICKED_PDF_WORKAROUND"] == "fedora"
WickedPdf.config.merge!(
{
exe_path: File.expand_path(
"~/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/wkhtmltopdf-binary-0.12.6.5/bin/wkhtmltopdf_centos_8_amd64"
),
enable_local_file_access: true
```js
function handleUploadProgress(event) {
//...
}
function handleDownloadProress(event) {
//...
}
function prepareXHR() {
@smedstadc
smedstadc / gist:f2743b419d216bb8f19b
Created March 29, 2016 00:00
Gnome 3 Mouse Fix
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
function logIt(it) {
console.log(it);
}
ajaxOptions = {
url: 'http://myrequest.com/?param1=true&param2=false',
dataType: 'jsonp',
jsonpCallback: 'logIt'
}
@smedstadc
smedstadc / deborator.rb
Created December 11, 2015 19:44
Basic Ruby Decorator
class Decorator
# Uncomment for Rails
#
# include ActionView::Helpers::UrlHelper
attr_reader :decorated
def initialize(decorated)
@decorated = decorated
init_hook
@smedstadc
smedstadc / read_only_hash.rb
Created April 12, 2015 23:42
Read Only Ruby Hash Snippet
# 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