Skip to content

Instantly share code, notes, and snippets.

View saveroo's full-sized avatar

Muhammad Surga Savero saveroo

View GitHub Profile
@saveroo
saveroo / 01-directory-structure.md
Created September 18, 2019 10:44 — forked from tracker1/01-directory-structure.md
Anatomy of a JavaScript/Node project.

Directory structure for JavaScript/Node Projects

While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.

Directories

  • lib/ is intended for code that can run as-is
  • src/ is intended for code that needs to be manipulated before it can be used
@saveroo
saveroo / conventional_commit_messages.md
Created September 18, 2019 10:43 — forked from qoomon/conventional-commits-cheatsheet.md
Conventional Commit Messages
@saveroo
saveroo / reactivity.js
Last active September 18, 2019 10:37
Reactivity Observer
let data = {price: 5, quantity: 2}
let total, salePrice, discountedTotal
let target = null
class Dep {
constructor() {
this.subscriber = []
}
@saveroo
saveroo / archflow.md
Last active March 18, 2019 03:38
archflow-md

Arch Environment Tricks

Tricks apps to use fake date & time without disabling NTPD

$ LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 FAKETIME="+900d" [Apps Location/Name]

Note: preload value is the location of libfaketime it could be different on each system.. /usr/local/lib as example

to find the libfaketime exact dir

find [Dir to seek fo] --name= [Could use wildcard] find ./ --name= "libfaketime.so.1"

@saveroo
saveroo / sign.js
Created November 21, 2017 15:21 — forked from nolim1t/sign.js
node.js HMAC SHA512 signing
var crypto = require("crypto");
function encrypt(key, str) {
var hmac = crypto.createHmac("sha512", key);
var signed = hmac.update(new Buffer(str, 'utf-8')).digest("base64");
return signed
}
@saveroo
saveroo / download website assets
Created November 16, 2017 10:12 — forked from christiangenco/download website assets
Use wget to download a website's assets, including images, css, javascript, and html. From http://www.linuxjournal.com/content/downloading-entire-web-site-wget
$ wget \
--recursive \
--no-clobber \
--page-requisites \
--html-extension \
--convert-links \
--domains website.org \
--no-parent \
www.website.org/tutorials/html/
@saveroo
saveroo / obat.rb
Created October 25, 2017 19:08 — forked from mkhuda/obat.rb
Obat Mujarab
case @obat
when "sering sakit"
"puasa sunnah"
when "wajah terlihat murung tidak bercahaya"
"shalat malam tahajud"
when "hati sempit"
"baca Al-Quran dan maknanya"
when "tidak bahagia"
"shalat diawal waktu"
@saveroo
saveroo / DiagramXML1.cs
Created February 15, 2017 08:19
c# logic backup
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Syncfusion.Windows.Forms.Diagram;
using System.Drawing.Imaging;
using Syncfusion.Windows.Forms.Tools;
@saveroo
saveroo / multiternary.rb
Created December 19, 2016 07:10
multiternary
@units = Unit.where(id: @unit_discount.map(&:unit_id) + @search.result.pluck(:unit_id) +
(params[:q].present? ? AvailabilityFact.where(vendor_id: @vendor.id)
.all_unit_inventory_at(Date.new(params[:q]['valid_date_gteq(1i)'].to_i, params[:q]['valid_date_gteq(2i)'].to_i, params[:q]['valid_date_gteq(3i)'].to_i),
Date.new(params[:q]['valid_date_lteq(1i)'].to_i, params[:q]['valid_date_lteq(2i)'].to_i, params[:q]['valid_date_lteq(3i)'].to_i)).pluck(:unit_id) : []))
.where { id << hidden_unit }.includes(:stock, variant: :product).joins(variant: :product).order('products.name ASC').page(params[:page]).per_page(50)
if params[:q]