Skip to content

Instantly share code, notes, and snippets.

@wzulfikar
wzulfikar / dt_editor.sql
Last active November 19, 2016 18:02
MySQL dump for Datatables Editor examples (https://editor.datatables.net/examples/index). Example for other DB: https://editor.datatables.net/manual/php/installing
--
--
-- MySQL tables used to run the Editor examples.
--
-- For more information about how the client and server-sides interact, please
-- refer to the Editor documentation: http://editor.datatables.net/manual .
--
--
@wzulfikar
wzulfikar / docker-ps-vertical
Last active March 14, 2024 13:36
vertical format for docker ps
export FORMAT="ID\t{{.ID}}\nNAME\t{{.Names}}\nIMAGE\t{{.Image}}\nPORTS\t{{.Ports}}\nCOMMAND\t{{.Command}}\nCREATED\t{{.CreatedAt}}\nSTATUS\t{{.Status}}\n"
// usage:
docker ps --format="$FORMAT"
@wzulfikar
wzulfikar / laravel-nginx.txt
Last active November 16, 2016 03:06
default laravel nginx
server {
listen 80;
server_name my.domain.com;
root /opt/production/my-web;
index index.php;
rewrite_log on;
#access_log /var/log/nginx/access.log;
#error_log /var/log/nginx/error.log;
@wzulfikar
wzulfikar / DashSnippets.txt
Created September 28, 2016 08:11
Snippet I use with Dash app (OSX)
// the format is
// //{description}
// {snippet}
// {sample output}
// display right arrow
>`
// display left arrow
@wzulfikar
wzulfikar / iStat Menus Settings.ismp
Created September 20, 2016 09:59
My preferred settings for iStat Menus (https://bjango.com/mac/istatmenus/)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>build</key>
<real>681</real>
<key>license</key>
<string>7765-5449-1074-5985-8835</string>
<key>preferences</key>
<dict>
/*
This document has been created with Marked.app <http://marked2app.com>
Please leave this notice in place, along with any additional credits below.
---------------------------------------------------------------
Title: Ulysses Freestraction Light
Author: Jonathan Poritsky <http://candlerblog.com>
Description: Based on the Freestraction color scheme used in Ulysses III <http://www.ulyssesapp.com>.
For more information read the introductory post: http://candlerblog.com/2013/04/11/ulysses-iii-and-marked/
*/
@wzulfikar
wzulfikar / diffTo.php
Last active September 20, 2016 07:30
Get seconds difference from current time to given time. Will always compare closest time.
<?php
function diffTo($toTime)
{
$now = strtotime('now');
$next = strtotime('today ' . $toTime);
if($next <= $now){
$next = strtotime('tomorrow ' . $toTime);
}
@wzulfikar
wzulfikar / populateInputValues.js
Last active September 28, 2016 08:03
Populate HTML input values with given object via jQuery
var populateInputValues = function(o) {
$.each(o, function(name, val){
$('input[name="' + name + '"]').val(val);
});
}
// sample usage via laravel blade
<script type="text/javascript">
populateInputValues({!! json_encode(request()->all()) !!});
</script>
@wzulfikar
wzulfikar / brew.txt
Last active November 3, 2016 00:29
`brew`-ing my mac
# install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" # <- see: http://brew.sh
# before `brew`-ing everything else
brew update && brew doctor
# quicklook plugins
brew cask install qlcolorcode qlstephen qlmarkdown quicklook-json qlprettypatch quicklook-csv betterzipql qlimagesize webpquicklook suspicious-package
brew install zsh-syntax-highlighting
@wzulfikar
wzulfikar / library
Created September 2, 2016 15:02
Snippets I use with Dash (OSX) - https://kapeli.com/dash
# the upper line is how we call the snippet,
# below it is content of the snippet.
clog`
console.log(@cursor);
date`
@date
time`