Skip to content

Instantly share code, notes, and snippets.

@tdbishop
tdbishop / iTermCandy.itermcolors
Created May 9, 2013 20:27
iTerm color settings, kinda candy-like
<?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>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.11764705926179886</real>
<key>Green Component</key>
<real>0.11372549086809158</real>
@tdbishop
tdbishop / bashPS1.sh
Created May 9, 2013 20:26
pretty PS1
PS1='\@ ${debian_chroot:+($debian_chroot)}\[\033[0;33m\]\u\[\033[0m\]@\[\033[0;32m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\n\$ '
#You can use this query :
SELECT table_name AS "Table",
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"
FROM information_schema.TABLES
WHERE table_schema = "$DB_NAME"
AND table_name = "$TABLE_NAME";
#... in order to know the size of a table and that :
<?php
$startTime = time();
$finalResults = array();
for ($j = 0; $j < 1000000; $j++) {
do {
$candidate = getToken();
} while (array_key_exists($candidate, $finalResults));
@tdbishop
tdbishop / telldontask.php
Last active December 10, 2015 22:58
tell, dont ask example
<?php
class InvoiceManager
{
private $em;
private $invoiceRepo;
private $highValue;
@tdbishop
tdbishop / gist:3836770
Created October 4, 2012 22:04
Equilibrium Point in an Array
<?php
function equi ( $A ) {
$countA = count($A);
$forwardSum = array();
$backwardSum = array();
for ($i = 0; $i < $countA; $i++) {
if ($i == 0) {
//$forwardSum[$i] = $A[$i];
$forwardSum[0] = 0;
} else {