Skip to content

Instantly share code, notes, and snippets.

@choonkeat
choonkeat / README.md
Created May 10, 2014 14:38
ActiveResource access to Shopify Discount API using email+password login

Usage

Provide SHOPIFY_SUBDOMAIN, SHOPIFY_EMAIL and SHOPIFY_PASSWORD environment variables, and discount.rb will configure itself.

Supported APIs are

  • Discount.find(:all)
  • Discount.find(:first)
  • Discount.create(...)
  • Discount#destroy
@vertexclique
vertexclique / cracking.md
Last active August 24, 2025 23:03
Cracking guide for Sublime Text 3 Build 3059 / 3065 ( Mac / Win x86_64 / Windows x86 / Linux x64 / Linux x86 )

MacOS

Build 3059

MD5: 59bab8f71f8c096cd3f72cd73851515d

Rename it to: Sublime Text

Make it executable with: chmod u+x Sublime\ Text

@monicao
monicao / rails_testing.md
Last active June 22, 2021 16:55
Setting up rails 4 with MiniTest, Fabrication and Guard
# Gemfile
group :development, :test do
  gem 'minitest-rails'
  gem 'fabrication'
end
@gavinballard
gavinballard / shopify_webhook.py
Last active August 15, 2021 19:04
Python view decorator for the HMAC verification of a Shopify Webhook.
import hashlib, base64, hmac, json, settings
def shopify_webhook(f):
"""
A decorator thats checks and validates a Shopify Webhook request.
"""
def _hmac_is_valid(body, secret, hmac_to_verify):
hash = hmac.new(body, secret, hashlib.sha256)
hmac_calculated = base64.b64encode(hash.digest())
@bMinaise
bMinaise / bs3-login-form.html
Created November 6, 2013 02:20
Bootstrap 3 - Login Form Example From: http://bootsnipp.com
<div class="container">
<div class="row">
<div class="col-sm-6 col-md-4 col-md-offset-4">
<h1 class="text-center login-title">Sign in to continue to Bootsnipp</h1>
<div class="account-wall">
<img class="profile-img" src="https://lh5.googleusercontent.com/-b0-k99FZlyE/AAAAAAAAAAI/AAAAAAAAAAA/eu7opA4byxI/photo.jpg?sz=120"
alt="">
<form class="form-signin">
<input type="text" class="form-control" placeholder="Email" required autofocus>
<input type="password" class="form-control" placeholder="Password" required>
@saxxi
saxxi / gist:6495116
Last active December 22, 2015 15:49
# Elastic search grouping solution
# As at present ElasticSearch does not provide a group_by equivalent, here's my attempt to do it manually.
# In the example we have articles made by some authors and I'd like to have relevant docs, but not more than one per author.
# Assumption.
#
# 1) I'm looking for relevant content
# 2) I've assumed that first 300 docs are relevant,
# So I consider only this selection, regardless many of these are from the same few authors.
# 3) for my needs I didn't "really" needed pagination, for me it was enough a "show more" button updated through ajax
def find_blog
case request.host
when "www.#{Setting.host}", Setting.host, nil
@current_blog = Blog.find_by_subdomain(request.subdomain)
else
if request.host.index(Setting.host)
@current_blog = Blog.find_by_subdomain(request.host.split('.').first)
else
# -*- encoding : utf-8 -*-
class Subdomain
def self.matches?(request)
case request.host
when Setting.host, "www.#{Setting.host}", nil
false
else
true
end
@ogt
ogt / howto-s3bucket.md
Last active March 25, 2022 21:31
HOWTO - Create an amazon s3 bucket with its own domain, access keys

Assume that we want to create a bucket called foo.mydomain.com, and you have already mydomain.com

1. Create the bucket.
  - go to AWS console, s3, select the s3 region that you want.
  - name the bucket foo.mydomain.com
  - save and then select -> click actions-> properties 
  -> in properties click permissions -> add permissions add VIEW for EVERYBODY (s3 files are unguessable urls)

2. Create the CNAME
@doitian
doitian / chrome.js
Created February 10, 2013 13:41
openAndReuseOneTabPerURL firefox and chrome version
function openAndReuseOneTabPerURL(url) {
window.chrome.tabs.query({url: url + '*'}, function (tabs) {
console.log(tabs);
if (tabs.length > 0) {
window.chrome.tabs.update(tabs[0].id, {active: true, highlighted: true});
} else {
window.chrome.tabs.create({url: url, active: true});
}
});
}