Skip to content

Instantly share code, notes, and snippets.

View Nosfheratu's full-sized avatar
🏠
Working from home

Fernando Serapio Nosfheratu

🏠
Working from home
View GitHub Profile
@niksumeiko
niksumeiko / git-checkout-their-remote-branch-ohmyzsh-alias.zsh
Last active November 10, 2021 06:29
Git checkout remote branch · ohmyzsh custom alias
# ~/.oh-my-zsh/custom/git-checkout-remote-branch-ohmyzsh-alias.zsh
unalias gcor
function gcor() {
if [ -n "$1" ]; then
if git show-ref -q --heads $1; then
gco $1
else
gfo $1
gco -t origin/$1
fi
@zulhfreelancer
zulhfreelancer / heroku_pg_db_reset.md
Last active January 29, 2024 10:09
How to reset PG Database on Heroku (for Rails app)?

It's important to note that running this reset will drop any existing data you have in the application

How to reset PG Database on Heroku?

  • Step 1: heroku restart
  • Step 2: heroku pg:reset DATABASE (no need to change the DATABASE)
  • Step 3: heroku run rake db:migrate
  • Step 4: heroku run rake db:seed (if you have seed)

One liner

@coderberry
coderberry / db.rake
Created July 10, 2014 14:46
rake db:migrate:reset_all
namespace :db do
namespace :migrate do
desc "runs db:drop db:create db:migrate for both development and test environments"
task :reset_all do
system('bundle exec rake db:migrate:reset')
system('bundle exec rake db:migrate:reset RAILS_ENV=test')
end
end
end
@ka8725
ka8725 / dbconfig.rake
Last active July 28, 2016 10:03
database.yml generator. Global Rake implementation
require 'yaml'
desc 'Generates database.yml, optional arguments: [adapter, user, password]'
task :dbconfig => 'database.yml'
file 'database.yml', [:adapter, :username, :password] do |t, args|
Dir.chdir('config')
args.with_defaults(:project_path => Dir.pwd)
DBConfigGenerator.new(t, args).generate
end
@anotheruiguy
anotheruiguy / web-fonts-asset-pipeline.md
Last active May 24, 2023 22:08
Custom Web Fonts and the Rails Asset Pipeline

Web fonts are pretty much all the rage. Using a CDN for font libraries, like TypeKit or Google Fonts, will be a great solution for many projects. For others, this is not an option. Especially when you are creating a custom icon library for your project.

Rails and the asset pipeline are great tools, but Rails has yet to get caught up in the custom web font craze.

As with all things Rails, there is more then one way to skin this cat. There is the recommended way, and then there are the other ways.

The recommended way

Here I will show how to update your Rails project so that you can use the asset pipeline appropriately and resource your files using the common Rails convention.

@thomaspark
thomaspark / subnav.css
Last active June 6, 2023 10:19
Subnav for Bootstrap 2
section {
padding-top: 60px;
}
.subnav {
margin-bottom: 60px;
width: 100%;
height: 36px;
background-color: #eeeeee; /* Old browsers */
background-repeat: repeat-x; /* Repeat the gradient */
@mahdi
mahdi / .gitignore
Created August 2, 2011 08:10
A .gitignore file for a .NET developer
#Junk Files
*.DS_Store
[Tt]humbs.db
#Visual Studio Files
[Oo]bj
[Bb]in
[Dd]ebug
[Bb]uild/
*.user
@WizardOfOgz
WizardOfOgz / gist:1012107
Created June 7, 2011 12:13
Save Base64-encoded images with Paperclip
class Avatar < ActiveRecord::Base
attr_accessor :content_type, :original_filename, :image_data
before_save :decode_base64_image
has_attached_file :image,
PAPERCLIP_CONFIG.merge(
:styles => {
:thumb => '32x32#',
:medium => '64x64#',