Skip to content

Instantly share code, notes, and snippets.

View absyah's full-sized avatar

Ardian Bahtiarsyah absyah

  • Semarang, Indonesia
View GitHub Profile
@absyah
absyah / summary.md
Created August 4, 2023 02:16 — forked from angelialau/summary.md
(Summary) The Art of Readable Code

A summary of The Art of Readable Code by Dustin Boswell and Trevor Foucher

  • Overall metric for readability: code should be written to minimise the time it would take someone else to fully understand it (able to modify the code and spot bugs) Ways to improve readability (ranked from easiest change to most time intensive)
  1. Naming of variables and functions:
    • Use specific, descriptive, succinct names that say the entity's value or purpose
    • Use concrete names instead of abstract names e.g. canListenOnPort > serverCanStart
    • Add important attributes e.g. units or state e.g. unsafeUrl, safeUrl > url
    • Can use shorter variable names for smaller scope
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import ElementClickInterceptedException, NoSuchElementException
from time import sleep
from selenium.common.exceptions import NoSuchElementException
EMAIL = "email@quipper.com"
PASSWORD = "password"
@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
# 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 / 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:

@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')
});
@absyah
absyah / awsstatus.coffee
Created November 17, 2015 13:33 — forked from jeremykarn/awsstatus.coffee
A Hubot script for monitoring the aws status rss feed and posting messages to a campfire room whenever there's a new update.
#
# Copyright 2012 Mortar Data Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@absyah
absyah / Gemfile
Created November 3, 2015 12:38 — forked from cblunt/Gemfile
Configure Carrierwave for Amazon S3 Storage and Heroku
# ...
gem 'carrierwave'
gem 'fog', '~> 1.0.0' # Need to specify version, as carrierwave references older (0.9.0) which doesn't allow configuration of Rackspace UK Auth URL
<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//