Skip to content

Instantly share code, notes, and snippets.

View blaze182's full-sized avatar
🌊
g'day

Paul Blaze blaze182

🌊
g'day
View GitHub Profile
@brunogaspar
brunogaspar / README.md
Last active October 7, 2022 09:08
Install wkhtmltopdf on Ubuntu (14.04 64-bit) or (16.04 64-bit)

Install wkhtmltopdf on Ubuntu

This was tested on:

  • Ubuntu 14.04 x64
  • Ubuntu 16.04 x64

Installation

@ssaunier
ssaunier / sidekiq.config
Created September 24, 2015 09:30
Running Sidekiq on AWS Elastic Beanstalk (Put that file in `.ebextensions` folder)
# Sidekiq interaction and startup script
commands:
create_post_dir:
command: "mkdir -p /opt/elasticbeanstalk/hooks/appdeploy/post"
ignoreErrors: true
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/50_restart_sidekiq.sh":
mode: "000755"
owner: root
group: root
@primeobsession
primeobsession / gist:f9d30c5ebc8b0486de14
Last active June 4, 2022 00:40
Install latest version of ImageMagick on Amazon Beanstalk
# Check if this is the very first time that this script is running
if ([ ! -f /root/.not-a-new-instance.txt ]) then
newEC2Instance=true
fi
if ([ $newEC2Instance ]) then
whoami
cd /tmp
@JulienSansot
JulienSansot / asynctest_controller.rb
Last active January 16, 2016 00:08
async controller in rails with Thin, EventMachine, em-synchrony, em-http-request
class AsynctestController < ApplicationController
require "em-synchrony/em-http"
def test
EventMachine.synchrony do
http = EventMachine::HttpRequest.new("https://www.google.co.uk/").get
render :json => {result: http.response}
# lib/capistrano/tasks/assets.rake
Rake::Task['deploy:assets:precompile'].clear
namespace :deploy do
namespace :assets do
desc 'Precompile assets locally and then rsync to remote servers'
task :precompile do
local_manifest_path = %x{ls public/assets/manifest*}.strip
@edelpero
edelpero / heroku_rails_phantomjs.md
Last active May 10, 2021 08:31
Heroku, Ruby on Rails and PhantomJS

#Heroku, Ruby on Rails and PhantomJS

In this post, I’m going to show you how to modify an existing Ruby on Rails app running on Heroku’s Cedar stack to use PhantomJS for screen scraping. If you’ve never heard of PhantomJS, it’s a command-line WebKit-based browser (that supports JavaScript, cookies, etc.).

Let’s get started. This is a high-level overview of the required steps:

  • Modify your app to use multiple Heroku buildpacks.
  • Extend your app to use both the Ruby as well as the PhantomJS buildpacks.
  • Confirm that everything worked.
@amolkhanorkar
amolkhanorkar / PG::Error: ERROR: new encoding (UTF8) is incompatible
Last active November 29, 2023 17:57
Postgres PG::Error: ERROR: new encoding (UTF8) is incompatible
======= Prolbem =================================================================================================================
I have installed : ruby-2.0.0,postgres-9.2 , now in rails app when I execute:
rake db:create , command I get:
PG::InvalidParameterValue: ERROR: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)
HINT: Use the same encoding as in the template database, or use template0 as template.
: CREATE DATABASE "my_db_name" ENCODING = 'unicode'.......
bin/rake:16:in `load'
@plentz
plentz / nginx.conf
Last active June 27, 2024 21:05
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@takeru
takeru / Gemfile
Last active January 17, 2016 14:56
Faraday async
# A sample Gemfile
source "https://rubygems.org"
# gem "rails"
gem 'faraday'
gem 'faraday_middleware'
gem 'em-synchrony'
gem 'em-http-request'
gem 'multi_xml'
@luisalima
luisalima / shoulda_cheat_model.rb
Created December 19, 2012 19:02
Shoulda model testing cheat sheet
# updated from the original @ http://cheat.errtheblog.com/s/rspec_shoulda
# just a subset -- models -- is included here. I'll update this, and create cheat sheets for others, as I go along.
# I marked the ones I added with NEW and also added the links to the corresponding code, as I think it's useful.
# Any comments/corrections are welcome!
# ================= Data and Associations =======================
# https://github.com/thoughtbot/shoulda-matchers/tree/master/lib/shoulda/matchers/active_record
it { should_not have_db_column(:admin).of_type(:boolean) }