Skip to content

Instantly share code, notes, and snippets.

View absyah's full-sized avatar

Ardian Bahtiarsyah absyah

View GitHub Profile
@absyah
absyah / Docker Commands
Last active August 19, 2019 12:42
Learn Docker
# show containers
docker ps
# Logging to container
docker logs -f <container_id>
# ssh to container
docker exec -it <container_id> /bin/bash
# build container
@absyah
absyah / samples.txt
Created February 21, 2019 01:30
Apisentris API Examples
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 December 28, 2018 05:46 — forked from sunny/base.rb
Rails utility class for objets to act like ActiveRecord::Base
# 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 November 26, 2018 22:48
iframe widget
<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
})};
profile_id category_name
68 Weekly Promo
# 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 April 16, 2018 08:09
mass linking script
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 January 28, 2018 14:56 — forked from iros/API.md
Documenting your REST API

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:

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 October 20, 2017 15:50 — forked from danro/remove-video.js
Remove HTML5 video and clear src attribute to prevent leaks.
$('video source').each(function(num,val){
$(this).attr('src', 'newSourceValue')
});