Skip to content

Instantly share code, notes, and snippets.

version: "3"
volumes:
redisdata: {}
mongodata: {}
networks:
front-external:
driver: overlay
external: true
version: "3"
volumes:
acme_json: {}
networks:
front-external:
driver: overlay
external: true
@samjaninf
samjaninf / jitai.user.js
Created May 29, 2019 17:16 — forked from obskyr/jitai.user.js
Jitai (字体): A fairly full-featured font randomizer for WaniKani.
// ==UserScript==
// @name Jitai
// @version 1.3.2
// @description Display WaniKani reviews in randomized fonts, for more varied reading training.
// @author Samuel (@obskyr)
// @copyright 2016-2018, obskyr
// @license MIT
// @namespace http://obskyr.io/
// @homepageURL https://gist.github.com/obskyr/9f3c77cf6bf663792c6e
// @icon http://i.imgur.com/qyuR9bD.png
@samjaninf
samjaninf / gist:a79a970ccf49752b786f3ac0730bd9fb
Last active January 3, 2019 16:07 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
@media (min-width: 768px){
body{ padding-top: 150px; }
}
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
<?php
// Array to CSV Function
// Copyright (c) 2014-2016, Ink Plant
// https://inkplant.com/code/array-to-csv
// last updated May 10, 2016
function array_to_csv($data,$args=false) {
if (!is_array($args)) { $args = array(); }
foreach (array('download','line_breaks','return','trim') as $key) {
// https://inkplant.com/code/custom-die
<?php
function custom_die($args=false,$h1=false,$show_header=true,$show_footer=true) {
//note: if $args comes in as a string, it is actually $args['error']
//this lets you access the function in shorthand
if (!is_array($args)) { $args = array('error'=>$args); }
//get all the options set
<?php
// CSV to Array Function
// Copyright (c) 2014-2015, Ink Plant
// https://inkplant.com/code/csv-to-array
// this version was last updated July 20, 2015
ini_set('auto_detect_line_endings',true);
function csv_to_array($file,$args=array()) {
// https://inkplant.com/code/csv-to-mysql
<?php
// CSV to MySQL Function
// Copyright (c) 2015, Ink Plant
// this version was last updated November 6, 2015
// https://inkplant.com/code/csv-to-mysql
ini_set('auto_detect_line_endings',true);
function csv_to_mysql($args=array()) {
// https://inkplant.com/code/spell-numbers
<?php
function spellnumber($x,$min=0,$max=100) {
if (!preg_match('/^-?([0-9]{1,15})(\.[0-9]+)?$/',$x)) { return $x; } //if not a number less than a quadrillion, leave it alone
elseif (strpos($x,'.') !== false) { list($int,$dec) = explode('.',$x); return number_format($int).'.'.$dec; } //if not an intenger
elseif (($min !== false) && ($x < $min)) { return number_format($x); } //return numeral if less than minimum
elseif (($max !== false) && ($x > $max)) { return number_format($x); } //return numeral if greater than maximum
// https://inkplant.com/code/ipv6-to-number
<?php
function ipaddress_to_ipnumber($ipaddress) {
$pton = @inet_pton($ipaddress);
if (!$pton) { return false; }
$number = '';
foreach (unpack('C*', $pton) as $byte) {
$number .= str_pad(decbin($byte), 8, '0', STR_PAD_LEFT);
}