Skip to content

Instantly share code, notes, and snippets.

Avatar
🍁
I ❤ U

Taufik Nurrohman taufik-nurrohman

🍁
I ❤ U
View GitHub Profile
@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
@taufik-nurrohman
taufik-nurrohman / ckeditor5-image-upload.js
Last active Jun 5, 2019
Enable image upload in CKEditor 5 without using the Easy Image service.
View ckeditor5-image-upload.js
/**
* This code is based on <https://github.com/pourquoi/ckeditor5-simple-upload>
* and will be implemented by <https://github.com/mecha-cms/extend.c-k-editor> in the future!
*/
// The upload adapter
var Adapter = function(loader, urlOrObject, t) {
var $ = this;
@taufik-nurrohman
taufik-nurrohman / easings.js
Created Apr 28, 2018 — forked from rezoner/easings.js
One argument easing equations
View easings.js
/*
A full list of simple easing equations inspired by GIST from greweb - https://gist.github.com/gre/1650294
Equations source - http://gsgd.co.uk/sandbox/jquery/easing/
*/
{
linear: function(t) {
return t
},
inQuad: function(t) {
View compose-function.js
// Reply for <https://medium.com/@Dewey92/cleaner-code-dengan-function-composition-137f30d928e4>
function compose() {
var i, arg = arguments,
output = arg.pop();
for (i = 0; i < arg.length; ++i) {
if (typeof arg[i] !== "function") continue;
output = arg[i](output);
}
return output;
@taufik-nurrohman
taufik-nurrohman / foobar.md
Created Jan 16, 2017 — forked from t32k/foobar.md
foo, bar, baz, qux, quux, corge, grault, garply, waldo, fred, plugh, xyzzy, thud
View foobar.md
You can’t perform that action at this time.