This file contains hidden or 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
wifi-menu | |
ping www.google.com | |
# setup disk partitions | |
cfdisk. | |
# format disk partitions | |
lsblk /dev/sda | |
mkfs.ext4 /dev/sda1 | |
mkfs.ext4 /dev/sda2 |
This file contains hidden or 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
import java.util.*; | |
class PurchaseOrder { | |
private final boolean reserved; | |
private final int clientId; | |
public PurchaseOrder(boolean reserved, int clientId) | |
{ |
This file contains hidden or 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 | |
define('CSS', '/css/compiled'); | |
define('CSS_PATH', realpath(__DIR__ . '/css')); | |
define('CSS_COMPILED', realpath(CSS_PATH . '/compiled')); | |
function css($css) | |
{ |
This file contains hidden or 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 | |
foreach ($users as $user) { | |
echo $user['name'] . ' [' . $user['address'] . '] (' . $user['age'] . ')'; | |
} | |
for ($i = 0; $i < count($users); $i = $i + 1) { | |
echo $users[$i]['name'] . ' [' . $users[$i]['address'] . '] (' . $users[$i]['age'] . ')'; | |
} |
This file contains hidden or 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 | |
$vcard = <<<EOT | |
BEGIN:VCARD | |
VERSION:2.1 | |
N:name;Full | |
FN:Full name | |
ORG:Company name | |
TITLE:Job title | |
END:VCARD |
This file contains hidden or 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
var TweetFetcher = function(id) | |
{ | |
this.id = id; | |
this.instance = 'tf_' + (new Date().getTime()); | |
window[this.instance] = this; | |
}; | |
TweetFetcher.prototype.fetch = function(cb, limit) | |
{ | |
this.cb = cb; |
This file contains hidden or 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
CREATE TABLE `snippet` ( | |
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, | |
`title` varchar(255) NOT NULL, | |
`description` text, | |
`snippet` text, | |
`tags` varchar(255) NOT NULL, | |
PRIMARY KEY (`id`), | |
FULLTEXT KEY `search` (`title`,`description`,`snippet`) | |
) ENGINE=MyISAM DEFAULT CHARSET=utf8 |
This file contains hidden or 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
function dump() | |
{ | |
$args = func_get_args(); | |
echo "\n<pre style=\"border:1px solid #ccc;padding:10px;margin:10px;font:14px courier;background:whitesmoke;display:block;border-radius:4px;\">\n"; | |
$trace = debug_backtrace(false); | |
$offset = (@$trace[2]['function'] === 'dump_d') ? 2 : 0; | |
echo "<span style=\"color:red\">" . @$trace[1+$offset]['class'] . "</span>:" . |
This file contains hidden or 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
/** | |
* iterates through key-value array and returns array with defined keys values | |
* @var Array $array | |
String $key | |
* @return Array | |
*/ | |
function array_key_value($array, $key) { | |
$output = array(); | |
foreach($array as $a) |
NewerOlder