Skip to content

Instantly share code, notes, and snippets.

View richardvenneman's full-sized avatar
🆒

Richard Venneman richardvenneman

🆒
View GitHub Profile
@richardvenneman
richardvenneman / derp.sh
Last active March 4, 2020 12:08
Pull Heroku Postgres DB excluding specific table data
# Using the `--exlude-table-data` argument for the `heroku pg:pull` command doesn't seem to be working.
# Instead we're going to copy the Heroku PG database by using the Postgres `pg_dump` and `pg_restore` commands.
# Get the "Connection info string" for myapp
heroku pg:credentials:url DATABASE_URL -a myapp
# Download the database, excluding the `visits` and `ahoy_events` table data.
pg_dump "<PASTE_CONNECTION_INFO_STRING_HERE>" --exclude-table-data visits --exclude-table-data ahoy_events -O -x -Fc -f without_vists_and_ahoy_events.out -v
# In myapp, setup an empty database
@richardvenneman
richardvenneman / _html5boilerplate.css.sass
Created September 25, 2011 16:18
HTML5 Boilerplate HAML & SASS
/*
* HTML5 ✰ Boilerplate
*
* What follows is the result of much research on cross-browser styling.
* Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
* Kroc Camen, and the H5BP dev community and team.
*
* Detailed information about this CSS: h5bp.com/css
*
* ==|== normalize ==========================================================
@richardvenneman
richardvenneman / gist:a454922c9874bcf46a3c40a880716b1d
Created April 27, 2016 11:28
rails 5 api Administrate stack trace
{"status":500,"error":"Internal Server Error","exception":"#\u003cActionView::Template::Error: undefined method `new_admin_booking_path' for #\u003c#\u003cClass:0x007fcf77e72e50\u003e:0x007fcf77e6a3e0\u003e\u003e","traces":{"Application Trace":[{"id":80,"trace":"appsignal (1.1.5) lib/appsignal/rack/rails_instrumentation.rb:15:in `call'"}],"Framework Trace":[{"id":0,"trace":"actionpack (5.0.0.beta3) lib/action_dispatch/routing/polymorphic_routes.rb:216:in `polymorphic_method'"},{"id":1,"trace":"actionpack (5.0.0.beta3) lib/action_dispatch/routing/polymorphic_routes.rb:130:in `polymorphic_path'"},{"id":2,"trace":"actionview (5.0.0.beta3) lib/action_view/routing_url_for.rb:102:in `url_for'"},{"id":3,"trace":"actionview (5.0.0.beta3) lib/action_view/helpers/url_helper.rb:196:in `link_to'"},{"id":4,"trace":"/Users/richard/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/bundler/gems/administrate-71a53e4e347f/app/views/administrate/application/index.html.erb:50:in `___sers_richard__rbenv_versions_______lib_ruby_gems____
@richardvenneman
richardvenneman / _floatl.scss
Created October 22, 2015 10:13
Floatl styling
.floatl--focused .floatl__label {
color: hsl(201, 73%, 54%);
}
.floatl--active {
.floatl__input {
padding: 1.4em 1em .6em 1em;
}
}
@richardvenneman
richardvenneman / _bg-variants.scss
Created November 12, 2013 16:00
This bg-variants mixin is a responsive images solution which supports multiple screen widths and densities. It uses CSS3 multiple backgrounds and is an improvement in user experience over just specifying backgrounds since any low res background image specified later in the stack will load first. This solution doesn't play well with IE8 as it wil…
//-----------------------------------------------------------------------------
// Background Variants
@mixin bg-variants($filename, $path: '/online/', $extension: 'jpg') {
background-image: url(#{$path + $filename + '.small.' + $extension});
@include hidpi(1.5) {
background-image:
url(#{$path + $filename + '.small@2x.' + $extension}),
url(#{$path + $filename + '.small.' + $extension});
@richardvenneman
richardvenneman / parallax.coffee
Created October 25, 2013 12:21
A simple CoffeeScript parallax responsive image implementation
class Parallax
options =
velocity: 15
constructor: ->
@imgs = ($ '.parralax img')
@offset = 0
@prepareImages()
@bindListeners()
@richardvenneman
richardvenneman / json_to_nano_object.rb
Created October 24, 2012 09:18
I use this method to retrieve some JSON and prepare the objects for NanoStore.
def self.update(username, &block)
BW::HTTP.get("#{Constants::API_endpoint}/events/#{username}") do |response|
if response.ok?
events = BW::JSON.parse(response.body)
::Event.delete
events.each { |e|
eventdata = e.each_with_object({}){ |(k,v), h| h[k.to_sym] = v }
eventData.each { |k,v| eventData.delete(k) if v.nil? }
::Event.create(eventData)
@richardvenneman
richardvenneman / Password.coffee
Created August 15, 2011 22:59
Basic Jasmine CoffeeScript test
window.Password = class Password
constructor: (passphrase) ->
@strength = @calcStrength passphrase.length
calcStrength: (len) ->
len--
if len / 3 > 10 # everything with a length-1 > 30 gets a strength of 10
10
else
@richardvenneman
richardvenneman / Default New Doc Sizes.txt
Created August 14, 2011 21:49
iOS and Android Photoshop presets.
;------------------------------------------------------------------------------
; Mobile screen sizes
;------------------------------------------------------------------------------
"mobile"
"iPhone" 320 480 pixels 163 dpi RGB 8 1.0 white "none"
"iPhone - Retina" 480 960 pixels 326 dpi RGB 8 1.0 white "none"
"iPad (portrait)" 768 1024 pixels 132 dpi RGB 8 1.0 white "none"
"iPad (landscape)" 1024 768 pixels 132 dpi RGB 8 1.0 white "none"
@richardvenneman
richardvenneman / gist:510266
Created August 5, 2010 19:37
sql typecasting
SELECT
`table`.`column`
FROM
`table`
ORDER BY
CAST(`table`.`column` AS INTEGER) DESC