Skip to content

Instantly share code, notes, and snippets.

@kevin-smets
kevin-smets / iterm2-solarized.md
Last active May 5, 2024 18:31
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@timothyandrew
timothyandrew / README.md
Last active December 16, 2023 17:05
Set up a seedbox (on DigitalOcean – Ubuntu) really quick

Introduction

  • This script lets you set up and use a temporary DigitalOcean droplet to download torrent files.
  • Once downloaded, they can be streamed down to your local machine.
  • This uses transmission-cli for the torrent client, and nginx to serve files.

Setup on Local Machine

  • This assumes that you have a DigitalOcean account and tugboat set up, as well as seedbox-setup.sh present in the current directory.
@teddyzeenny
teddyzeenny / gist:5613485
Last active December 17, 2015 12:59
Deleting a parent when you have `dependent: :destroy` on the server
// Deleting a parent when you have `dependent: :destroy` on the server
// given `parent` a parent record
// `children` the parent's children
var childrenTransaction, parentTransaction;
childrenTransaction = this.get('store').transaction();
childrenTransaction.add(parent);
parent.deleteRecord();
parentTransaction.add(parent);
@wrburgess
wrburgess / gist:5528649
Last active November 24, 2022 15:29
Backup Heroku Postgres database and restore to local database

Grab new backup of database

Command: heroku pgbackups:capture --remote production

Response: >>> HEROKU_POSTGRESQL_COLOR_URL (DATABASE_URL) ----backup---> a712

Get url of backup download

Command: heroku pgbackups:url [db_key] --remote production

curl -XDELETE "localhost:9200/test"
curl -XPUT "localhost:9200/test" -d '{
"mappings": {
"doc": {
"properties": {
"price": {
"type": "long"
},
"colour": {
"type": "string",
@julian7
julian7 / include-vs-cover-vs-between.rb
Created November 11, 2012 18:09
include? vs. cover? vs. between?
require 'date'
require 'benchmark'
n = 1_000_000
start_date = Date.new(2012, 01, 01)
end_date = Date.new(2012, 03, 01)
act_date = Date.new(2012, 02, 01)
Benchmark.bm(10) do |x|
x.report('include?') do
@vigo
vigo / ruby-tips.md
Created November 4, 2012 22:50
Ruby Tips

Ruby Tips

Genel

  • Herşey bir Object (Nesne)
  • Her Object BasicObjectden türemiş. (Objective-C NSObject gibi...)
  • Object.methods ile o nesneye ait tüm method'lar
  • Object.methods.inspect string olarak method'lar
  • Mutlaka bir şey geriye döner. Hiçbir şey dönmese nil döner.

Style Guide

@subelsky
subelsky / puma_rails_heroku.rb
Created October 31, 2012 13:51
Setting up Puma and Rails on Heroku
# Gemfile
gem "puma"
# Procfile
web: bundle exec puma -p $PORT -e $RACK_ENV -C config/puma.rb
# add to config block config/environments/production.rb
config.threadsafe!
# get rid of NewRelic after_fork code, if you were doing this:
@roberto
roberto / _flash_messages.html.erb
Created August 13, 2012 22:47
Rails flash messages using Twitter Bootstrap
<% flash.each do |type, message| %>
<div class="alert <%= bootstrap_class_for(type) %> fade in">
<button class="close" data-dismiss="alert">×</button>
<%= message %>
</div>
<% end %>
@johnantoni
johnantoni / unicorn.rb
Created August 2, 2012 15:48
unicorn + nginx setup + ssl
unicorn.rb
-----------------------------------
application = "jarvis"
remote_user = "vagrant"
env = ENV["RAILS_ENV"] || "development"
RAILS_ROOT = File.join("/home", remote_user, application)
worker_processes 8
timeout 30