Skip to content

Instantly share code, notes, and snippets.

View bkenny's full-sized avatar
💭
Shipping Products

Brian Kenny bkenny

💭
Shipping Products
View GitHub Profile
@bkenny
bkenny / base64_encode.rb
Created August 21, 2013 12:58
Quickly encode a file in ruby to base64
require 'base64'
# Open the file you wish to encode
data = File.open('/Users/bkenny/Desktop/d3cce16ee41411e296c022000a1f980f_101.mp4').read
# Encode the puppy
encoded = Base64.encode64(data)
# Spit it out into one continous string
puts encoded.gsub(/\n/,"")
@bkenny
bkenny / dockup.markdown
Created April 12, 2017 10:59
Handy Dokku Goodies

File upload error

When you get the error: 413 “Request Entity Too Large” error with uploading a file

mkdir /home/dokku/appname/nginx.conf.d/
echo 'client_max_body_size 50M;' > /home/dokku/appname/nginx.conf.d/upload.conf
chown dokku:dokku /home/dokku/appname/nginx.conf.d/upload.conf #I don't know if this is needed
service nginx reload
@bkenny
bkenny / grab_and_store_heroku_pg_backup.markdown
Last active March 17, 2017 18:50
Grab and Store PG Backup from Heroku

Exporting from Heroku

heroku pg:backups capture && curl -o ~/Desktop/app_latest.dump `heroku pg:backups public-url`

Importing locally

pg_restore --verbose --clean --no-acl --no-owner -h localhost -d app_db ~/Desktop/app_latest.dump

No turbo links on a link

<%= link_to "View More", search_path, id: "showMore", class: "btn btn-lg btn-outline primary ripple", data: { no_turbolink: true } %>

Crazy Selects

<%= f.text_field :townland_id, value: f.object.townland.name, placeholder: "What area do you live in? E.g. Dundrum" %>
@bkenny
bkenny / meta.html
Created June 20, 2016 12:37
META Tags
<meta name="description" content="We partner with startups to design, build and ship your concept into a product and drive engagement.">
<meta name="keywords" content="app, development, design, startups, dublin, ireland, user experience, UX, usability, design, web design, training, courses, classes, online training, mobile UX, product design, application design, responsive design">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="MiniCorp | Startup Studio" />
<meta property="og:type" content="website" />
<meta property="og:description" content="We partner with startups to design, build and ship your concept into a product and drive engagement." />
<meta property="og:image" content="http://minicorp.ie/assets/colab-4336cb491fb0ba0ce1294d234ea456ba34df72919a6ca139905dd9d4685c9b87.png"/>
<meta name="twitter:card" content="summary" />

Introduction

MiniCorp is a startup studio from Dublin, Ireland. We partner with startup founders to help them create new products, services, craft new brands and create successful companies. We get in at the early stage of developing a company and product where we can make the most impact. These people are passionate about solving problems through technology. We are too.

Our Ruby on Rails Engineer internship allows us to find great talent. Teach and mentor them through problem solving and business development. This is not just an engineering role, you’ll discover how to create businesses, find target markets and above all else, ship great products.

Our prerequisites are simple:

Write great quality code.

We’ll need to see a GitHub profile or similar. Something where we can take a peak and the genius in your work. We’re not talking Enigma cryptography here, but something to show you understand good coding practices.

@bkenny
bkenny / db-backup.sh
Created July 1, 2013 13:40
Simple bash script to zip all mysql dbs and back them up to S3
#!/bin/bash
BACKUP="/tmp/s3/db"
DATE=`date +"%Y-%m-%d"`
DIR="${BACKUP}/${DATE}/"
if [ ! -d $DIR ];
then
mkdir -p $DIR
fi

List of Ruby Awesome

Install gems without a specific group

If you had a group in your GemFile e.g.

group :awesome
  gem 'super_awesome
end

You could exclude that with

@bkenny
bkenny / spots_popular_tweet.rb
Created March 26, 2013 13:51
Post a tweet with the most popular Spot from yesterday - http://www.spots.io
@bkenny
bkenny / gist:5031375
Last active December 14, 2015 04:49
Grab products where tag like
@products = Product.where(:source => params[:vendor], :city => params[:location]).includes(:tags).where(['tags.title LIKE ?', @tag.title])