Skip to content

Instantly share code, notes, and snippets.

View sabril's full-sized avatar

Muhammad Syaiful Sabril sabril

View GitHub Profile
@sabril
sabril / checkSoldOut.js
Created November 8, 2018 02:55
Javascript test for sureswift capital
function checkSoldOut() {
if ($('#SingleOptionSelector-0').val() == 'Large') {
$( "<div id='email_when_available' style='padding: 0 5px;'><button style='color: #fff; background-color: #900; width: 100%; '>EMAIL WHEN AVAILABLE</button></div>" ).insertAfter( ".product-form" )
} else {
$('#email_when_available').remove()
}
}
$('#SingleOptionSelector-0').on('change', function() {
checkSoldOut()
@sabril
sabril / zoho_invoice_service.rb
Created December 21, 2018 07:01
Zoho Invoide Service using Oauth
require 'oauth2'
require 'json'
module ZohoServices
class Invoice
attr_reader :oauth_auth_code, :client
def initialize
@customer_id = "CUSTOMER_ID" # define this customer_id
@query_root = "https://invoice.zoho.com/api/v3"
@sabril
sabril / appointment.rb
Created January 11, 2019 01:50
Twilio Phone Number Provision and Release
class Appointment < ApplicationRecord
# .. this model is long and has many lines of code, so we cut it where it's important :-D
phony_normalize :phone, :default_country_code => 'US', :add_plus => true
# Associations
has_many :appointment_call_logs, dependent: :destroy
has_many :call_logs, through: :appointment_call_logs, source: :call_log
has_one :masked_number, as: :callable
#callbacks
@sabril
sabril / ci.yml
Last active October 23, 2019 03:26
# .github/workflows/ci.yml
name: CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:11