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 / 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
@ziyan-junaideen
ziyan-junaideen / clear-books-request-list-of-entities.py
Last active October 28, 2015 14:09
I tried to connect to the api using `python request.py` and it gives 500 error, invalid xml to be precise. What would the solution be for this.
import requests
url = "https://secure.clearbooks.co.uk/api/soap/"
header = {"Content-Type": "text/xml"}
myxml = """<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
xmlns:cb="https://secure.clearbooks.co.uk/api/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:enc="http://www.w3.org/2003/05/soap-encoding">
class Site < ActiveRecord::Base
belongs_to :domain
# has_one :account, through: :domain # Stack level too deep
end
class Domain < ActiveRecord::Base
has_one :account, through: :site
has_one :site
end
def destroy
@post.destroy
flash[:success] = "Post deleted!"
redirect_to posts_path
end
def destroy
@post.destroy
flash[:success] = "Post deleted!"
redirect_to posts_path
end
for container in $("[data-columns]")
container.removeAttr('data-columns')
require "subscribem/constraints/subdomain_required"
Subscribem::Engine.routes.draw do
constraints(Subscribem::Constraints::SubdomainRequired) do
scope :module => "account" do
get "/", :to => "dashboard#index", as: :account_root
end
end
get "/", to: "dashboard#index", as: :root
@ziyan-junaideen
ziyan-junaideen / gist:8f4bfe067840ac427b06
Created February 17, 2015 16:18
Digital Ocean - Rails Setup with Cache Store in Ubuntu VPS

Digital Ocean is quickly gaining the attention of developers and enterprises around the world. Depending on the project I wold recommend either Heroku or Digital Ocean for a client.

While I have experience with BSD and other Linux distributions, I haven't played with them from a very long time and I tend to forget a lot.

# Partial caching setup
Cache.configure do |config|
config.logger = @logger
config.verbose = settings.options.verbose
config.debug = settings.options.debug
end
@cache = Cache.instance
Deface::Override.new(
:virtual_path => "spree/layouts/admin",
:name => "add_plugins_menu_item_to_spree_admin_menu",
:insert_top => "body",
:partial => "spree/slim_admin/plugins_menu"
)