Skip to content

Instantly share code, notes, and snippets.

@ahmadmilzam
ahmadmilzam / main.go
Last active July 8, 2024 02:51
Code snippet
package main
import (
"encoding/json"
"net/http"
"sync"
"time"
"github.com/gorilla/mux"
)
// TODO: Implement in-memory store
@ahmadmilzam
ahmadmilzam / HashTable.js
Created June 13, 2018 20:16 — forked from alexhawkins/HashTable.js
Correct Implementation of a Hash Table in JavaScript
var HashTable = function() {
this._storage = [];
this._count = 0;
this._limit = 8;
}
HashTable.prototype.insert = function(key, value) {
//create an index for our storage location by passing it through our hashing function
var index = this.hashFunc(key, this._limit);
@ahmadmilzam
ahmadmilzam / ex1-prototype-style.js
Created November 24, 2017 18:55 — forked from getify/ex1-prototype-style.js
OLOO (objects linked to other objects) pattern explored (with comparison to the prototype style of the same code)
function Foo(who) {
this.me = who;
}
Foo.prototype.identify = function() {
return "I am " + this.me;
};
function Bar(who) {
Foo.call(this,"Bar:" + who);
@ahmadmilzam
ahmadmilzam / markup-tab.html
Last active October 24, 2017 13:29
Bukabantuan Tab HTML Markup
<div class="c-tab js-tab">
<ul class="c-tab__nav js-tab__nav">
<li class="c-tab__list js-tab__list is-active">
<a class="c-tab__link js-tab__link" href="#section1">Desktop</a>
</li>
<li class="c-tab__list js-tab__list">
<a class="c-tab__link js-tab__link" href="#section2">Mobile</a>
</li>
<li class="c-tab__list js-tab__list">
<a class="c-tab__link js-tab__link" href="#section3">Android</a>
// remove parent without removing childen
function unwrap(wrapper) {
// place childNodes in document fragment
var docFrag = document.createDocumentFragment();
while (wrapper.firstChild) {
var child = wrapper.removeChild(wrapper.firstChild);
docFrag.appendChild(child);
}
// replace wrapper with document fragment
// parseUri 1.2.2
// (c) Steven Levithan <stevenlevithan.com>
// MIT License
function parseUri (str) {
var o = parseUri.options,
m = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
uri = {},
i = 14;
@ahmadmilzam
ahmadmilzam / sublime-user-settings.json
Created April 28, 2017 20:01
My sublime settings
{
// "auto_complete": false,
"auto_complete_commit_on_tab": true,
// Allow auto-complete suggestion within snippets.
"auto_complete_with_fields": true,
"always_show_minimap_viewport": true,
"binary_file_patterns":
[
"*.ttf",
"*.tga",
@ahmadmilzam
ahmadmilzam / sample.scss
Created April 16, 2017 18:49
SCSS Triangle Mixins
.triangle-top {
@include triangle(top);
}
.triangle-bottom {
@include triangle(bottom);
}
.triangle-left {
@include triangle(left);
}
.triangle-right {
{
"bootstrapped": true,
"in_process_packages":
[
],
"installed_packages":
[
"AdvancedNewFile",
"Alignment",
"Babel",
[
{ "keys": ["ctrl+alt+b"], "command": "open_in_browser" },
{ "keys": ["ctrl+space"], "command": "auto_complete" },
{ "keys": ["ctrl+space"], "command": "replace_completion_with_auto_complete", "context":
[
{ "key": "last_command", "operator": "equal", "operand": "insert_best_completion" },
{ "key": "auto_complete_visible", "operator": "equal", "operand": false },
{ "key": "setting.tab_completion", "operator": "equal", "operand": true }
]
},