Skip to content

Instantly share code, notes, and snippets.

@henrik
henrik / dokku_on_digital_ocean.md
Last active May 12, 2022 14:38
Notes from running Dokku on Digital Ocean.

My notes for Dokku on Digital Ocean.

These may be a bit outdated: Since I originally wrote them, I've reinstalled on a newer Dokku and may not have updated every section below.

Commands

Install dokku-cli (gem install dokku-cli) for a more Heroku-like CLI experience (dokku config:set FOO=bar).

# List/run commands when not on Dokku server (assuming a "henroku" ~/.ssh/config alias)

ssh henroku dokku

@devonzuegel
devonzuegel / .pryrc
Last active August 7, 2023 06:16
My .pryrc file
# === EDITOR ===
Pry.editor = 'vi'
require 'awesome_print'
# == Pry-Nav - Using pry as a debugger ==
Pry.commands.alias_command 'c', 'continue' rescue nil
Pry.commands.alias_command 's', 'step' rescue nil
Pry.commands.alias_command 'n', 'next' rescue nil
# === CUSTOM PROMPT ===
@colszowka
colszowka / dns_check.rb
Last active October 12, 2022 10:39
Ruby DNS Check
require 'resolv'
class DnsCheck
attr_reader :host
def initialize(host)
@host = host
end
def a
@a ||= Resolv::DNS.new.getresources(host, Resolv::DNS::Resource::IN::A)

Integrating TinyMCE in an ember-cli app

TinyMCE is a javascript WYSIWYG editor that is highly configurable and has a ton of features and plugins. It integrates with jQuery and, with a bit of work, it can be integrated in your ember-cli app.

Step 1: Install TinyMCE:

bower install --save tinymce

Step 2: Import the required files into your app via broccoli. In order to do that you will need a plugin called broccoli-static-compiler:

@lopezjurip
lopezjurip / gist:a817e96ec833e7667274
Last active June 9, 2020 22:26
DigitalOcean+Rails+Puma+Dokku+Postgress
# Based on: http://donpottinger.net/blog/2014/11/17/bye-bye-heroku-hello-dokku.html
# Add to gemfile:
ruby '2.1.2'
gem 'pg'
gem 'puma'
gem 'rails_12factor'
gem 'searchkick'
gem 'typhoeus'
@merqlove
merqlove / optimization.rake
Created January 9, 2015 13:55
PostgreSQL optimization tasks for ActiveRecord
namespace :optimization do
desc "Provide DB vacuum for production environment"
task :vacuum => :environment do
begin
tables = ActiveRecord::Base.connection.tables
tables.each do |table|
ActiveRecord::Base.connection.execute("VACUUM FULL ANALYZE #{table};")
end
rescue Exception => exc
Rails.logger.error("Database VACUUM error: #{exc.message}")
@mihai-scurtu
mihai-scurtu / gist:4a488007cfd150f09a4d
Last active August 15, 2018 11:30
Integrating TinyMCE in an ember-cli app

Integrating TinyMCE in an ember-cli app

TinyMCE is a javascript WYSIWYG editor that is highly configurable and has a ton of features and plugins. It integrates with jQuery and, with a bit of work, it can be integrated in your ember-cli app.

Step 1: Install TinyMCE:

bower install --save tinymce

Step 2: Import the required files into your app via broccoli. In order to do that you will need a plugin called broccoli-static-compiler:

@chsh
chsh / pg_pub_sub.rb
Last active May 2, 2024 08:13
PostgreSQL LISTEN/NOTIFY example for ruby
#
# A:
# pubsub = PgPubSub.new('channelname')
# pubsub.subscribe do |data|
# puts "data: #{data} is coming!"
# end
#
# B:
# pubsub = PgPubSub.new('channelname')
# pubsub.publish("hello world")
@joshuapowell
joshuapowell / gist:e209a4dac5c8187ea8ce
Last active March 11, 2023 18:37
Setup Postgres.app to use PostGIS on OS X

Download and Install Postgres.app

Before we can setup PostGIS we need to have a local version of Postgresql installed and running. The most effecient way to do this is to download and install Postgres.app.

Spatially Enable your Postgres Database

Once Postgres.app is installed in your computers /Applications directory. Open the Terminal and enter the following two commands

psql -d DATABASE_NAME -f /Applications/Postgres.app/Contents/Versions/9.3/share/postgresql/contrib/postgis-2.1/postgis.sql
@xerardoo
xerardoo / Mexico
Created November 3, 2014 20:29
Ciudades y Estados de Mexico
{
"mexico":{
"estado":[
{
"id":1,
"iso":"MX-AGS",
"capital":"Aguascalientes",
"nombre":"AGUASCALIENTES",
"municipios":{
"municipio":[