A ZSH theme optimized for people who use:
- Solarized
- Git
- Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)
For Mac users, I highly recommend iTerm 2 + Solarized Dark
<?php | |
// db info | |
$db_host = 'localhost'; // local only connection | |
$db_port = 3306; // default mysql port | |
$db_database = 'db_user'; // database username | |
// initiate dns string | |
$dns = "mysql:host=$db_host;port=$db_port;dbname=$db_database"; | |
// create database object or close connection |
<?php | |
// inside included file | |
defined('INCLUDE') or die('No direct access allowed.'); | |
?> | |
<?php | |
// inside includer | |
define('INCLUDE', true); | |
?> |
var params = {}; | |
var queryString = location.search.substring(1); // For # params use location.hash | |
var regex = /([^&=]+)=([^&]*)/g; | |
var m; | |
while (m = regex.exec(queryString)) { | |
params[decodeURIComponent(m[1])] = decodeURIComponent(m[2]); | |
} |
// source: http://stackoverflow.com/a/9251169/649239 | |
var escape = document.createElement('textarea'); | |
function escapeHTML(html) { | |
escape.innerHTML = html; | |
return escape.innerHTML; | |
} | |
function unescapeHTML(html) { |
// Class creation | |
function Vehicle(p) { | |
this.brand = p.brand || ""; | |
this.model = p.model || ""; | |
this.wheels = p.wheels || 0; | |
} | |
// Main class' methods | |
Vehicle.prototype.getBrand = function () { | |
return this.brand; |
<? | |
class entry{ | |
private $id = -1; // required | |
private $title = ""; // required | |
private $author = -1; // required, author ID | |
private $excerpt = ""; // either turn title into excerpt or manually enter one | |
private $date = ""; // required | |
// #TODO | |
// post type interface? |
# Clear screen | |
cls | |
# Get user | |
$USER = $PWD.toString() | |
$USER = $USER.Remove(0, 9) | |
# Get hostname | |
$HOSTNAME = HOSTNAME.exe |
F12:: | |
DetectHiddenWindows, on | |
If WinExist("posh~git") OR WinExist("Windows PowerShell") | |
{ | |
If WinActive("posh~git") OR WinActive("Windows PowerShell") | |
{ | |
WinHide | |
if(temptitle="") | |
WinActivate ahk_class Shell_TrayWnd |
// returns true if your browser supports calc() | |
myapp.checkCalc = function (prefix = '') { | |
var el = document.createElement('div'); | |
el.style.cssText = prefix + 'width: calc(1px);'; | |
return !!el.style.length; | |
}; | |
// returns true if your browser supports any version of calc(), prefixed or not | |
myapp.checkAllCalc = function (prefix = '') { | |
return myapp.checkCalc('-webkit-') || myapp.checkCalc('-moz-') || myapp.checkCalc(); |