Skip to content

Instantly share code, notes, and snippets.

View hanafivan's full-sized avatar
😎
On vacation

Iyan Hanafi van Tony hanafivan

😎
On vacation
  • Indonesia
View GitHub Profile
{
"author": "Arslan",
}
{
"author": "Iyan Hanafi Van Tony"}
const validate = require('validate.js');
const moment = require('moment-timezone');
const mustache = require('mustache');
const fs = require('fs');
const { NotFoundError } = require('../../../../helpers/error');
const logger = require('../../../../helpers/utils/logger');
const wrapper = require('../../../../helpers/utils/wrapper');
const Query = require('./query');
const QueryUser = require('../../../user/repositories/queries/query');
const model = require('../../../billing/repositories/queries/query_model');
JavaScript: string.replace(/\([^()]*\)/g, '')
PHP: preg_replace('~\([^()]*\)~', '', $string)
Perl: $s =~ s/\([^()]*\)//g
Python: re.sub(r'\([^()]*\)', '', s)
C#: Regex.Replace(str, @"\([^()]*\)", string.Empty)
VB.NET: Regex.Replace(str, "\([^()]*\)", "")
Java: s.replaceAll("\\([^()]*\\)", "")
Ruby: s.gsub(/\([^()]*\)/, '')
R: gsub("\\([^()]*\\)", "", x)
Lua: string.gsub(s, "%([^()]*%)", "")
@hanafivan
hanafivan / 0x000012gy2g17ff-bill-receipt.markdown
Created June 14, 2020 09:16
0x000012gy2g17ff Bill Receipt
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>A simple, clean, and responsive HTML invoice template</title>
<style>
.invoice-box {
max-width: 800px;
@hanafivan
hanafivan / node-pdf-generator.js
Created June 7, 2020 15:46 — forked from adamgibbons/node-pdf-generator.js
Display or download PDF from node.js server
var restify = require('restify')
, port = process.env.PORT || 3000
, Phantom = require('phantom')
, tmpdir = require('os').tmpdir()
, fs = require('fs');
var server = restify.createServer();
function setResponseHeaders(res, filename) {
res.header('Content-disposition', 'inline; filename=' + filename);
@hanafivan
hanafivan / node-pdf-generator.js
Created June 7, 2020 15:45 — forked from adamgibbons/node-pdf-generator.js
Display or download PDF from node.js server
var restify = require('restify')
, port = process.env.PORT || 3000
, Phantom = require('phantom')
, tmpdir = require('os').tmpdir()
, fs = require('fs');
var server = restify.createServer();
function setResponseHeaders(res, filename) {
res.header('Content-disposition', 'inline; filename=' + filename);

Firing up LaTex on macOS 🔥

As I'm writing this small tutorial, I assume you've read my previous one about setting up macOS, so if for any tool I'll use without explanation, look to that other article.

MacTex

The full version IS NOT MANDATORY, as in the tutorial that follows I installed the smaller version of MacTeX and proceded installing every needed dependency. Installing the complete package is about ~3.5GB of download and ~5GB on disk, the smaller one is just about 80MBs.

Click here to download the complete version or here to download the smaller version.

Gnuplot

{
"code": 200,
"results": {
"data": [
{
"id_perjalanan": "sriwijaya_api_1",
"flight_count": 1,
"detail": [
{
"flight_id": "SJ 522",