This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Json2Html = (o) -> | |
if typeof o is 'object' and o isnt null | |
if o.constructor is Array | |
parts = for part in o | |
"<li class=\"#{typeof part}\">#{new Json2Html(part).toString()}</li>" | |
@html += "<ol class=\"array\">#{parts.join('')}</ol>" | |
else | |
parts = for attr of o | |
"<li class=\"#{typeof attr}\"><span class=\"attribute\">#{attr}</span><span class=\"value\">#{new Json2Html(o[attr]).toString()}</span></li>" | |
@html += "<ul class=\"object\">#{parts.join('')}</ul>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
chflags nohidden ~/Library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FREQUENCY=${1:-daily} | |
DB_BACKUP_DIR_ROOT="/root/mysqlbackups/$FREQUENCY" | |
DB_BACKUP_DIR_TODAY="$DB_BACKUP_DIR_ROOT/`date +%Y-%m-%d`" | |
DATESTRING=$(date +%Y.%m.%dT%H-%M-%S) | |
# Create the backup directory | |
mkdir -p $DB_BACKUP_DIR_TODAY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Converts Umlauts from iso8859-1? to utf8 | |
* by philipp staender <[email protected]> | |
* Usage: `php iso_utf8_converter.php fromfile.txt > tofile.txt` | |
*/ | |
$map = array( | |
"Â" => "", | |
"Ã́" => "ô", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.cms .cms-content-fields, .cms .cms-content { | |
background: #eee; | |
} | |
.cms-menu { | |
background: #eee; | |
box-shadow: rgba(0, 0, 0, 0.2) 0 0 10px; | |
} | |
.cms-menu-list li a { | |
background: none; | |
border: 0px solid #888; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en-GB"><head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<title>Temporarily Offline</title> | |
<style type="text/css" media="screen"> | |
html, | |
body { | |
height: 100%; | |
margin: 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'net/http' | |
require 'net/smtp' | |
# Brian Wigginton | |
# http://www.bwigg.com/2008/10/ruby-script-to-check-site-availability/ | |
# 10/7/2008 | |
# | |
# Check's availabilty of a website. Needs to be run via a cron job. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__BEGIN__ | |
*vimtips.txt* For Vim version 7.3. | |
------------------------------------------------------------------------------ | |
" new items marked [N] , corrected items marked [C] | |
" *best-searching* | |
/joe/e : cursor set to End of match | |
3/joe/e+1 : find 3rd joe cursor set to End of match plus 1 [C] | |
/joe/s-2 : cursor set to Start of match minus 2 | |
/joe/+3 : find joe move cursor 3 lines down | |
/^joe.*fred.*bill/ : find joe AND fred AND Bill (Joe at start of line) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have marked with a * those which I think are absolutely essential | |
Items for each section are sorted by oldest to newest. Come back soon for more! | |
BASH | |
* In bash, 'ctrl-r' searches your command history as you type | |
- Input from the commandline as if it were a file by replacing | |
'command < file.in' with 'command <<< "some input text"' | |
- '^' is a sed-like operator to replace chars from last command | |
'ls docs; ^docs^web^' is equal to 'ls web'. The second argument can be empty. | |
* '!!:n' selects the nth argument of the last command, and '!$' the last arg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
backup_tables('localhost', 'user', 'passw', 'databasename', '*', true); | |
/* backup the db OR just a table */ | |
function backup_tables($host, $user, $pass, $name, $tables = '*', $filename = null) { | |
$return = ""; | |
$link = mysqli_connect($host, $user, $pass, $name); |