Skip to content

Instantly share code, notes, and snippets.

View zaimramlan's full-sized avatar
👨‍💻
Engineering

Zaim Ramlan zaimramlan

👨‍💻
Engineering
View GitHub Profile
@zaimramlan
zaimramlan / RubyConsoleAllObjects.md
Last active September 7, 2016 08:18
View all objects in Ruby Console
ActiveRecord::Base.connection.tables
@zaimramlan
zaimramlan / GitBranchingRemoteBranch.md
Last active September 11, 2016 15:11
Git - Locally branching into a remote branch

Step 1: Fetch latest data from [REMOTE_NAME] i.e. origin

$ git fetch [REMOTE_NAME]

Step 2: Create and checkout into the desired remote branch

$ git checkout --track [REMOTE_NAME]/[REMOTE_BRANCH_NAME]
@zaimramlan
zaimramlan / SimpleHTTPServer.md
Last active September 11, 2016 15:12 — forked from zulhfreelancer/SimpleHTTPServer.md
Start SimpleHTTPServer Using Mac Terminal

Step 1: cd into project folder

cd /path/

Step 2: Enter the following

$ python -m SimpleHTTPServer 8000
@zaimramlan
zaimramlan / HTMLAttributeHideElement.md
Last active September 12, 2016 02:21
Create own HTML tag to hide element of the same class

Step 1: Add the following jQuery snippet to your JS file

$(function(){
    $("[data-hide]").on("click", function(){
        $("." + $(this).attr("data-hide")).hide();
    });
});
@zaimramlan
zaimramlan / SendAjaxRequest.MD
Last active September 17, 2016 14:21
Send AJAX Request via JS Function
function ajax_request() {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
        if (this.readyState == [READY_STATE] && this.status == [HTTP_RESPONSE_CODE]) {
            // do something
        }
    };
    xhttp.open("GET", [REQUEST_PATH], true);
 xhttp.send();
@zaimramlan
zaimramlan / HTML5FormValidation.MD
Last active September 20, 2016 08:46
Form Validation with HTML 5
<input type=[TYPE] pattern=[REGULAR_EXPRESSION] title=[HINT]>

Value(s) for REGULAR_EXPRESSION

^\d{4}-\d{3}-\d{4}$: For telephone numbers. (i.e. 0000-000-0000)

[a-zA-Z0-9]+: For alphanumeric values.

@zaimramlan
zaimramlan / CLICopyPasteCommands.MD
Last active September 27, 2016 19:50
Copy and Paste Shell Commands via CLI

To Copy:

$ [COMMANDS] | pbcopy

To cd into path in clipboard:

$ cd $(pbpaste)
@zaimramlan
zaimramlan / LighttpdReverseProxy.MD
Last active November 13, 2016 12:05
Reverse Proxy With Lighttpd
### Reverse Proxy Begins ###

# redirect all '/sub_directory' request to '/sub_directory/' so that all static files are
# serve in the 'sub_directory' directory instead of the root directory
url.redirect = ("^/sub_directory$" => "/sub_directory/")

# start a proxy server at port 8001 to serve at the url exactly beginning with '/sub_directory/'
$HTTP["url"] =~ "^/sub_directory/+" {
 proxy.server = ( "" =&gt; ("" =&gt; ( "host" =&gt; "127.0.0.1", "port" =&gt; 8001 )))
@zaimramlan
zaimramlan / AppendURLParamInstapage.js
Created January 18, 2017 13:15
Script to auto append URL Parameters into links within InstaPage
/*
* PROBLEM: Instapage 'says' it appends the URL Parameters into the links in the landing pages,
* but they actually did not.
* SOLUTION: This is the script made to auto append url parameters into links
*
* BEGIN --->
*/
$('body').ready(function() {
var appended_url;
@zaimramlan
zaimramlan / WPCheatSheet.MD
Last active February 24, 2017 13:30
Wordpress Theme CheatSheet Links