Skip to content

Instantly share code, notes, and snippets.

😒
Nothing. Just me.

Taufik Nurrohman tovic

😒
Nothing. Just me.
Block or report user

Report or block tovic

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View example.ngix
fastcgi_param PHP_VALUE = "register_globals=0;magic_quotes_gpc=0;session.use_trans_sid=1;session.cookie_lifetime=0";
fastcgi_param PHP_FLAG = "display_errors=off";
charset UTF-8
# location ~ ^/.+ {
# fastcgi_pass phpcgi;
# }
rewrite ^id([0-9]*) profille.php?id=$1&$args last
@tovic
tovic / 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;
@tovic
tovic / 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;
@tovic
tovic / php-html-css-js-minifier.php
Last active May 29, 2019
PHP Function to Minify HTML, CSS and JavaScript
View php-html-css-js-minifier.php
<?php
// Based on <https://github.com/mecha-cms/extend.minify>
define('MINIFY_STRING', '"(?:[^"\\\]|\\\.)*"|\'(?:[^\'\\\]|\\\.)*\'|`(?:[^`\\\]|\\\.)*`');
define('MINIFY_COMMENT_CSS', '/\*[\s\S]*?\*/');
define('MINIFY_COMMENT_HTML', '<!\-{2}[\s\S]*?\-{2}>');
define('MINIFY_COMMENT_JS', '//[^\n]*');
define('MINIFY_PATTERN_JS', '/[^\n]+?/[gimuy]*');
define('MINIFY_HTML', '<[!/]?[a-zA-Z\d:.-]+[\s\S]*?>');
@tovic
tovic / 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
@tovic
tovic / 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
@tovic
tovic / 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) {
@tovic
tovic / codemirror-0.js
Last active Feb 15, 2018
CodeMirror Hotkeys for Bold and Italic
View codemirror-0.js
editor.addKeyMap({
// bold
'Ctrl-B': function(cm) {
var s = cm.getSelection(),
t = s.slice(0, 2) === '**' && s.slice(-2) === '**';
cm.replaceSelection(t ? s.slice(2, -2) : '**' + s + '**', 'around');
},
// italic
'Ctrl-I': function(cm) {
var s = cm.getSelection(),
You can’t perform that action at this time.