Skip to content

Instantly share code, notes, and snippets.

Avatar
🍁
I ❤ U

Taufik Nurrohman taufik-nurrohman

🍁
I ❤ U
View GitHub Profile
View 1-elementary-os-apps.md

elementaryOS Apps and Configs

⚠️ No longer maintained! ⚠️

This guide has been updated for elementaryOS v5.0+.

Enbale PPA support

sudo apt-get update
sudo apt-get -y install software-properties-common
@taufik-nurrohman
taufik-nurrohman / Tiny JavaScript tokenizer.js
Created Nov 1, 2020 — forked from borgar/Tiny JavaScript tokenizer.js
A compact tokenizer written in JavaScript.
View Tiny JavaScript tokenizer.js
/*
* Tiny tokenizer
*
* - Accepts a subject string and an object of regular expressions for parsing
* - Returns an array of token objects
*
* tokenize('this is text.', { word:/\w+/, whitespace:/\s+/, punctuation:/[^\w\s]/ }, 'invalid');
* result => [{ token="this", type="word" },{ token=" ", type="whitespace" }, Object { token="is", type="word" }, ... ]
*
*/
@taufik-nurrohman
taufik-nurrohman / .vimrc
Last active Nov 12, 2020
Generic Vim Settings
View .vimrc
" Set default encoding
set encoding=utf-8
" Show line number(s)
set number
set ruler
" Enable line wrap
set wrap
@taufik-nurrohman
taufik-nurrohman / lexer.js
Created Oct 11, 2020 — forked from pepasflo/lexer.js
A regex-based javascript lexer / scanner / tokenizer
View lexer.js
#!/usr/bin/env node
var assert = require('assert');
// Each lexed token is a array of three integers:
// 1. the "token type": an index into the list of token patterns.
// 2. the index into the input string marking the start of this token.
// 3. the length of the token.
// The list of "token types" which our lexer understands:
@taufik-nurrohman
taufik-nurrohman / mecha.nginxconf
Last active Jul 15, 2020
Using Mecha under Nginx instead of Apache web server.
View mecha.nginxconf
server {
listen 443 ssl;
root /path/to/www;
index index.php index.html;
server_name mecha-cms.com;
@taufik-nurrohman
taufik-nurrohman / liquid-template-list-sentence-from-array.liquid
Created Jul 7, 2019
Generate text “foo, bar, baz and qux” from array input in Liquid by https://github.com/mecha-cms
View liquid-template-list-sentence-from-array.liquid
{% assign total_items = items.size %}
{% for item in items %}
{% if forloop.index > 1 %}
{% if forloop.index != total_items %}, {% else %} and {% endif %}
{% endif %}
{{ item }}
{% endfor %}
View clock.html
<style>
div {
width: 200px;
height: 200px;
background: lime;
border-radius: 100%;
position: relative;
}
span {
position: absolute;
View lava-nav.html
<style>
nav {
position: relative;
background: orange;
color: black;
}
nav ul,
nav li {
margin: 0;
padding: 0;
@taufik-nurrohman
taufik-nurrohman / magic-methods.js
Created May 6, 2019 — forked from loilo/magic-methods.js
PHP Magic Methods in JavaScript
View magic-methods.js
function magicMethods (clazz) {
// A toggle switch for the __isset method
// Needed to control "prop in instance" inside of getters
let issetEnabled = true
const classHandler = Object.create(null)
// Trap for class instantiation
classHandler.construct = (target, args) => {
// Wrapped class instance
@taufik-nurrohman
taufik-nurrohman / git.php
Last active Dec 29, 2018
GitHub Repository Browser API
View git.php
<?php
if (!isset($_GET['r'])) {
echo '<p style="color:red;">Missing `r` parameter.</p>';
exit;
}
// <https://developer.github.com/apps/building-oauth-apps/creating-an-oauth-app>
$user = '03d2df6cd302*******'; // client ID
You can’t perform that action at this time.