Skip to content

Instantly share code, notes, and snippets.

🚀
Bulding fun-project

Ardian Bahtiarsyah absyah

View GitHub Profile
@absyah
absyah / samples.txt
Created Feb 21, 2019
Apisentris API Examples
View samples.txt
Apisentris API endpoints
table name: programmers
### Get Programmers
[GET] https://apisentris.com/api/v1/programmers
example:
--------
curl -H "client_id: 141000"\
-H "access_token: 3zov2Syn0ahUfqwuFYw0VQ"\
@absyah
absyah / base.rb
Created Dec 28, 2018 — forked from sunny/base.rb
Rails utility class for objets to act like ActiveRecord::Base
View base.rb
# encoding: utf-8
# Base class to inherit from for objects to act like ActiveRecord::Base
# without using a database. Lets you use validations, errors, forms, routes.
#
# Example:
# class Exporter < Base
# attributes_accessor :email, :data
# end
class Base
extend ActiveModel::Naming
@absyah
absyah / index.html
Last active Nov 26, 2018
iframe widget
View index.html
<script>
(function(d, h, m){
var js, fjs = d.getElementsByTagName(h)[0];
if (d.getElementById(m)){return;}
js = d.createElement(h); js.id = m;
js.onload = function(){
window.mytimezoneis({
position: "left", // left || right
emailhash: "e5507bee9e0bb54a1c5ea5df164c74a1", // your md5 encoded email address
})};
View gist:c9cc9e0ddc8ad54af52f47f252a59523
# Video: http://rubyhoedown2008.confreaks.com/08-chris-wanstrath-keynote.html
Hi everyone, I'm Chris Wanstrath.
When Jeremy asked me to come talk, I said yes. Hell yes. Immediately. But
then I took a few moments and thought, Wait, why? Why me? What am I supposed
to say that's interesting? Something about Ruby, perhaps. Maybe the
future of it. The future of something, at least. That sounds
keynote-y.
@absyah
absyah / execute
Last active Apr 16, 2018
mass linking script
View execute
csv_text = File.read('/home/ardian/Downloads/mass_link.csv')
csv = CSV.parse(csv_text, :headers => true)
csv.each do |row|
hash = row.to_hash
hash['SKU Elevenia']
hash['Master SKU Forstok']
MassLink.new(hash['Master SKU Forstok'], hash['SKU Elevenia']).link
end
@absyah
absyah / API.md
Created Jan 28, 2018 — forked from iros/API.md
Documenting your REST API
View API.md

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

View meleduk_controller.rb
def priority_setting
@ahp_setting = current_user.ahp_setting
unless @ahp_setting.blank?
@pairwise = Matrix.identity(7).to_a
arr = []
@ahp_setting.attributes.each do |i, val|
unless i == "id" || i == "user_id" || i == "created_at" || i == "updated_at"
@absyah
absyah / remove-video.js
Last active Oct 20, 2017 — forked from danro/remove-video.js
Remove HTML5 video and clear src attribute to prevent leaks.
View remove-video.js
$('video source').each(function(num,val){
$(this).attr('src', 'newSourceValue')
});
View create_item.rb
# url https://partner.staging.shopeemobile.com/api/v1/item/add
# headers
# {
# :"Content-type"=>"application/json",
# :Authorization=>"27b2a692fbcd1b4b97824479389b900680b5abb18c5b8a0e20004a6c1158eb99",
# :"cache-control"=>"no-cache"
# }
#
#
# response
You can’t perform that action at this time.