Skip to content

Instantly share code, notes, and snippets.

View ziyan-junaideen's full-sized avatar
👋
How you doing?

Ziyan Junaideen ziyan-junaideen

👋
How you doing?
View GitHub Profile
@ziyan-junaideen
ziyan-junaideen / C:\Users\mzjde\chef-repo\cookbooks\myhaproxy\recipies\default.rb
Created October 2, 2017 14:53
When I run `sudo chef-client` I get an error... It says to open an issue with chef-stacktrace.out, given I am learning chef chances are the issue is me. Appreciate any help :)
#
# Cookbook:: myhaproxy
# Recipe:: default
#
# Copyright:: 2017, The Authors, All Rights Reserved.
# node.default['haproxy']['members'] = [{
# 'hostname' => 'web1',
# 'ipaddress' => '192.168.10.43',
# 'port' => 80,
@ziyan-junaideen
ziyan-junaideen / contact_form.rb
Created May 17, 2017 04:55
# ActiveJob::SerializationError: Unsupported argument type: ContactForm# ./app/models/contact_form.rb:22:in `process' # ./spec/models/contact_form_spec.rb:20:in `block (3 levels) in <top (required)>' # ./spec/models/contact_form_spec.rb:23:in `block (3 levels) in <top (required)>'
# Form object for contact form
class ContactForm
include ActiveModel::Model
attr_accessor(
:name,
:email,
:phone,
:message
)
@ziyan-junaideen
ziyan-junaideen / rspec_model_testing_template.rb
Created March 26, 2017 04:44 — 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
context "GET index" do
#context "POST create" do
#context "GET show" do
#context "PATCH update" do (or PUT update)
#context "DELETE destroy" do
#context "GET new" do
class Status::Representer
class Index < Roar::Decorator
with_statuses = Class.new(Create) do
collection :statuses, decorator: Status::Representer::Show, embed: true
end
end
class Show < Roar::Decorator
end
end
@ziyan-junaideen
ziyan-junaideen / install-postgresql-9.6-in-ubuntu-16.04.md
Created February 21, 2017 06:33
How to install PostgreSQL 9.6 in Ubuntu 16.04

Background

I believe Ubuntu 16.04 comes with PostgreSQL 9.5. Thats good for a start, but it is a matter of time before you have the need of a PostgreSQL 9.6 cluster. For me it was to import a PG backup from Heroku.

The procedure couldn't have been any easier and is described below. If you are interested in upgrading your old cluster to 9.6 afterwards, you may be interested in this.

Instructions

@ziyan-junaideen
ziyan-junaideen / upgrade-postgres-9.5-to-9.6.md
Last active January 14, 2018 20:33
How to Update PostgreSQL from v9.5 to v9.6 in an Ubuntu 16.04 system

Background

I was starting a new project and wanted to pull a pg backup from heroku to fix a bug.

➜  review_sys git:(bugfix/33-numeric-updats) heroku pg:pull DATABASE_URL xyz_dev --remote production
heroku-cli: Pulling postgresql-vertical-abcdefg ---> xyz_dev
pg_dump: server version: 9.6.1; pg_dump version: 9.5.5
pg_dump: aborting because of server version mismatch
pg_restore: [archiver] input file is too short (read 0, expected 5)
➜ ~ npm install -g sinopia
npm WARN deprecated minimatch@1.0.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated node-uuid@1.4.3: use uuid module instead
npm WARN deprecated tough-cookie@1.2.0: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
/home/ziyan/.npm-global/bin/sinopia -> /home/ziyan/.npm-global/lib/node_modules/sinopia/bin/sinopia
> dtrace-provider@0.4.0 install /home/ziyan/.npm-global/lib/node_modules/sinopia/node_modules/bunyan/node_modules/dtrace-provider
> node scripts/install.js
@ziyan-junaideen
ziyan-junaideen / gist:be292914377b417bb220
Created March 11, 2016 10:32
Error with rails and loading gems
dcommerce|master⚡ ⇒ rails generate devise:install
/home/ziyan/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'devise'. (Bundler::GemRequireError)
from /home/ziyan/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /home/ziyan/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
from /home/ziyan/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
from /home/ziyan/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
from /home/ziyan/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
from /home/ziyan/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
from /home/ziyan/Development/jdeen/dcommerce/config/application.rb:7:in `<top (required)>'
from /home/ziyan/.rvm
@ziyan-junaideen
ziyan-junaideen / base-64image.txt
Created November 18, 2015 10:00
The Image (base64) causing a wrong upload path when used with CarrierWave and CarrierWave base 64
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA1IAAAJxCAIAAADHCxR8AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJkoRyQCQLsAYFWBUiwCwMIAoKxAIi4EwK4BgFm2MkcCgL0FAHaOWJAPQGAAgJlCLMwAIDgCAEMeE80DIEwDoDDSv+CpX3CFuEgBAMDLlc2XS9IzFLiV0Bp38vDg4iHiwmyxQmEXKRBmCeQinJebIxNI5wNMzgwAABr50cH+OD+Q5+bk4eZm52zv9MWi/mvwbyI+IfHf/ryMAgQAEE7P79pf5eXWA3DHAbB1v2upWwDaVgBo3/ldM9sJoFoK0Hr5i3k4/EAenqFQyDwdHAoLC+0lYqG9MOOLPv8z4W/gi372/EAe/tt68ABxmkCZrcCjg/1xYW52rlKO58sEQjFu9+cj/seFf/2OKdHiNLFcLBWK8ViJuFAiTcd5uVKRRCHJleIS6X8y8R+W/QmTdw0ArIZPwE62B7XLbMB+7gECiw5Y0nYAQH7zLYwaC5EAEGc0Mnn3AACTv/mPQCsBAM2XpOMAALzoGFyolBdMxggAAESggSqwQQcMwRSswA6cwR28wBcCYQZEQAwkwDwQQgbkgBwKoRiWQRlUwDrYBLWwAxqgEZrhELTBMTgN5+ASXIHrcBcGYBiewhi8hgkEQcgIE2