Skip to content

Instantly share code, notes, and snippets.

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

Wasif Hossain wasifhossain

🏠
Working from home
View GitHub Profile
# frozen_string_literal: true
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do

This recipe describes the classes, controllers, and jobs used by Standard Notes to build our own custom-fit Mailchimp replacement.

With the parts here, you should be able to put together your own email campaign system directly in your Rails app, removing the need to use an expensive online newsletter service.

@wasifhossain
wasifhossain / upgrade-postgres-9.5-to-9.6.md
Last active January 6, 2018 00:05 — forked from delameko/upgrade-postgres-9.5-to-9.6.md
Upgrading PostgreSQL from 9.5 to 9.6 on Ubuntu 16.04

TL;DR

Install Postgres 9.6, and then:

sudo pg_dropcluster 9.6 main --stop
sudo pg_upgradecluster 9.5 main
sudo pg_dropcluster 9.5 main
@wasifhossain
wasifhossain / rails_switch_branch.py
Created December 3, 2017 19:58 — forked from skyriverbend/rails_switch_branch.py
Rails: Switch branches and run migrations
#!/usr/local/bin/python
"""
To use this script, you must be in the root directory of a Rails project that
is using git. You should also make sure that your directory does not contain any
uncommitted changes. Then run:
$ python rails_switch_branch.py name_of_another_branch
Running the above will do the following:
@wasifhossain
wasifhossain / rspec_model_testing_template.rb
Created August 2, 2017 13:18 — forked from SabretWoW/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
require 'rails_helper'
RSpec.describe TodosController, :type => :controller do
describe "GET #index" do
#describe "POST #create" do
#describe "GET #show" do
#describe "PATCH #update" do (or PUT #update)
#describe "DELETE #destroy" do
#describe "GET #new" do
@wasifhossain
wasifhossain / pagination.md
Created June 5, 2017 01:29 — forked from mislav/pagination.md
"Pagination 101" by Faruk Ateş

Pagination 101

Article by Faruk Ateş, [originally on KuraFire.net][original] which is currently down

One of the most commonly overlooked and under-refined elements of a website is its pagination controls. In many cases, these are treated as an afterthought. I rarely come across a website that has decent pagination, and it always makes me wonder why so few manage to get it right. After all, I'd say that pagination is pretty easy to get right. Alas, that doesn't seem the case, so after encouragement from Chris Messina on Flickr I decided to write my Pagination 101, hopefully it'll give you some clues as to what makes good pagination.

Before going into analyzing good and bad pagination, I want to explain just what I consider to be pagination: Pagination is any kind of control system that lets the user browse through pages of search results, archives, or any other kind of continued content. Search results are the o

@wasifhossain
wasifhossain / atom_extenstions.sh
Created June 3, 2017 13:49 — forked from shivabhusal/atom_extenstions.sh
shell script to install most commonly used tools for Ruby/Rails development in Atom Text Editor
#! /usr/bin/bash
apm install markdown-preview
apm install language-ruby
apm install autocomplete-ruby
# Lets you maintain long history of items you copied in past using `CTRL + SHIFT + v`
apm install clipboard-history
apm install goto-definition