Skip to content

Instantly share code, notes, and snippets.

View ahmadvaroqua's full-sized avatar
😀

Ahmad Varoqua ahmadvaroqua

😀
View GitHub Profile
@hopsoft
hopsoft / db.rake
Last active February 5, 2025 13:23
Rails rake tasks for dump & restore of PostgreSQL databases
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
end
puts cmd
@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active April 21, 2025 10:43
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@chrisb
chrisb / gist:4d6a09c6cc1ca2e1b14e
Last active November 25, 2022 04:15
Homebrew, Ruby, and Rails on OS X 10.10

OS X 10.10 Guide

Here's what I did to get things working.

1. Install Xcode 6

Yep, over at: https://developer.apple.com

2. Install the Command Line Tools (CLT)

#!/bin/sh
# A Ubuntu 14.04 install aimed for Ruby on Rails development
# This box start with a basic Ubuntu 14.04 (trusty) based on phusion/ubuntu-14.04-amd64
# And it adds the following packages aimed for rails development
# - rbenv and ruby-build
# - ruby 2.1.2 with bundler
# - Git 1.9.1
@peterc
peterc / methods_returning.rb
Last active October 29, 2023 03:10
Object#methods_returning - to work out which method on an object returns what we want
require 'stringio'
require 'timeout'
class Object
def methods_returning(expected, *args, &blk)
old_stdout = $>
$> = StringIO.new
methods.select do |meth|
Timeout::timeout(1) { dup.public_send(meth, *args, &blk) == expected rescue false } rescue false
# .railsrc
-B #Skip Bundle
-T #Skip Test-Unit
-d postgresql #Use postgres
@leonardteo
leonardteo / endless-app-template.rb
Last active January 2, 2016 06:29
Rails Application Template with Endless Gem
# Endless Rails application template
# For use with v1.0.3
#
# This should be copied to https://gist.github.com/leonardteo/8263273
#
# Usage:
# rails new [app name] -m https://gist.github.com/leonardteo/8263273/raw/endless-app-template.rb
# Front-end gems
gem 'slim'
@t-io
t-io / osx_install.sh
Last active January 17, 2025 09:54
Install most of my Apps with homebrew & cask
#!/bin/sh
echo Install all AppStore Apps at first!
# no solution to automate AppStore installs
read -p "Press any key to continue... " -n1 -s
echo '\n'
echo Install and Set San Francisco as System Font
ruby -e "$(curl -fsSL https://raw.github.com/wellsriley/YosemiteSanFranciscoFont/master/install)"
echo Install Homebrew, Postgres, wget and cask
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@therouv
therouv / magento-db-cleanup.sql
Last active November 10, 2020 06:54
DB cleanup script for Magento with some common database tables.
SET FOREIGN_KEY_CHECKS=0;
-- Customers
TRUNCATE `customer_entity`;
TRUNCATE `customer_entity_datetime`;
TRUNCATE `customer_entity_decimal`;
TRUNCATE `customer_entity_int`;
TRUNCATE `customer_entity_text`;
TRUNCATE `customer_entity_varchar`;
@bomberstudios
bomberstudios / sketch-plugins.md
Last active February 26, 2024 07:02
A list of Sketch plugins hosted at GitHub, in no particular order.