Skip to content

Instantly share code, notes, and snippets.

View godDLL's full-sized avatar

Yuli C. godDLL

View GitHub Profile
@godDLL
godDLL / go-to-home-router.php
Last active March 9, 2016 23:18
Buy a $5 VPS, get your own DynDNS
<?php // this will redirect to your home IP, can use a port for port-forwarding
// crontab -e
// 20,40,0 * * * * /usr/bin/env curl 'http://5usd-a-mo-vps.com/h.php?update&http=8080' >/dev/null
// ?update
if( isset($_GET['update'] ) or 'POST' === $_SERVER['REQUEST_METHOD']){
$gw= array(
"ip" =>$_SERVER['REMOTE_ADDR'],
@godDLL
godDLL / config.fish
Last active February 29, 2016 23:42
Homebrew PATH should come first and be exported. Also, Git status.
# ~/.config/fish/config.fish
# used with OS X El Capitan
set -e PATH[5] # assuming (/usr/local/bin /usr/bin /bin /usr/sbin /sbin /usr/local/bin /opt/X11/bin)
set -xg PATH $HOME/bin /usr/local/bin $PATH
@godDLL
godDLL / ready-min.js
Last active January 17, 2016 16:28
cross-browser "boot-loader" function under 500b
(function(w,d){"use strict";var dcl="DOMContentLoaded",rsc="onreadystatechange";w.ready=function(f){var x=function r(){if(!d.body)return void w.setTimeout(r,1);f()};if("loading"!==d.readyState)return x();if(d.addEventListener){var c=function l(){d.removeEventListener(dcl,l,false);x()};d.addEventListener(dcl,c,false);w.addEventListener("load",c,false)}else if(d.attachEvent){var c=function l(){d.detachEvent(rsc,l);x()};d.attachEvent(rsc,c);w.attachEvent("load",c)}}})(window,window.document);
@godDLL
godDLL / ijhash.js
Last active January 17, 2016 16:03
a fast String hashing function
#!/usr/bin/env node
// kinda like the base32 of String.hashCode() from java
// use from your SHELL, or as a Node module
module.exports= function ijhash (str){
if (!str.length)
return 0
var c, r= 0
@godDLL
godDLL / amd-es3.md
Last active October 11, 2015 10:41
Concise, pick-and-choose code libraries.

AMD, CJS and global Window namespaced modules for JavaScript.
Universal Module Definition IE6

Reactive programming with Observables.
Kefir

Request routing after the initial page-load.
PathJS IE7, Firefox 3.6, Chrome 9

Install web development tools to Mavericks (OS X 10.9)

Strongly opinionated set of guides to quickly setup OS X Mavericks for web development. By default OS X hides stuff that normal people don't need to see. These settings are better defaults for developers.

I don't want: any sounds, annoying confirmation dialogs, hidden extensions, superflous animations, unnecessary things running like Dashboard, Notification center or Dock(Alfred/spotlight works better for me).

These are my opinions. Read this document through and pick up the good parts to your preferences.

System preferences

@godDLL
godDLL / gist:6dfeb1e3e4aa6dcbe69f
Created August 24, 2014 14:51
Fixes reordering of nestedSortable Pages in Wolf CMS admin panel.
htdocs/wolf/app/views/page/children.php | 4 ++--
htdocs/wolf/app/views/page/index.php | 3 +--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/htdocs/wolf/app/views/page/children.php b/htdocs/wolf/app/views/page/children.php
index 35de777..eda18d5 100644
--- a/htdocs/wolf/app/views/page/children.php
+++ b/htdocs/wolf/app/views/page/children.php
@@ -19,7 +19,7 @@
<ul<?php if ($level == 1) echo ' id="site-map" class="sortable tree-root"'; else echo ' class="sortable child"'; ?>>
@godDLL
godDLL / import.php
Last active August 29, 2015 14:02
AMD-style modules (as found in Javascript) for PHP >= 5.4
<?php /*! php-import v0.2.5 (c)2014 Yuli Che. <god.dll@icloud.com> @license MIT */
/*
* Javascript's AMD-style modules for PHP >= 5.4
*
*
* USAGE: you write code modules that are scope-isolated and export objects.
*
* <?php /*! PROJECT_URL v0.0.0 (c)2014 YOUR_NAME <YOUR_EMAIL> @license MIT *\/
* defined('PHP_IMPORT') or die(1);
* return new Object(array(
@godDLL
godDLL / amd-js.html
Last active August 29, 2015 13:56
HTML5 kickstart with AMD Javascript and Responsive CSS
<!doctype HTML>
<meta charset=utf-8>
<meta name=viewport content="width=device-width,initial-scale=1">
<meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1">
<title></title>
<!--[if IE]><script>(function(){var e="abbr,article,aside,audio,canvas,datalist,details,dialog,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video".split(','),i=e.length;while(i--){document.createElement(e[i])}})()</script><![endif]-->
<script>
function init(){
@godDLL
godDLL / timer-example.log
Last active January 2, 2016 18:19
Works for me on Mac OS X.
$ timer Boring Customer \#4
Name your timer? wordpress
14:12 Started timer wordpress
0s > wait
14:12 Paused timer wordpress
9s + ; 5-minute configuration
9s +
14:22 Started timer wordpress
22m15s > x
14:45 Total time wordpress 22m15s