Skip to content

Instantly share code, notes, and snippets.

Avatar
🚽
Developer

Soon Van randomecho

🚽
Developer
View GitHub Profile
@randomecho
randomecho / base64-image-saver.php
Created Feb 20, 2013
Create and save image from Base 64 string
View base64-image-saver.php
/**
* Create and save image from Base 64 string
*
*/
public function generate_image($base64_string, $save_location)
{
$gen_image = imagecreatefromstring(base64_decode($base64_string));
if ($gen_image !== false)
{
imagejpeg($gen_image, $save_location);
@randomecho
randomecho / core.html
Last active Dec 10, 2015
Plain HTML5 template based off of H5BP and other sites
View core.html
<!DOCTYPE html><html><head><meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="" />
<link rel="author" href="" />
<link rel="alternate" type="application/rss+xml" title="" href="" />
<link rel="canonical" href="" />
<meta name="description" content="" />
<meta name="author" content="" />
<meta name="generator" content="" />
<meta name="dcterms.rightsHolder" content="" />
@randomecho
randomecho / git-it-good.md
Last active Oct 13, 2015
bagged dipping dots of git commands and config settings
View git-it-good.md

[alias].gitconfig

quick search of commit messages (and showing hash) with certain word

search = !sh -c 'git log --grep=$1 --pretty=format:\"%h%C(bold yellow) %s%C(reset)\"' -
$ git search wax // e.g. list out all commits that contain "wax" in message

export last X commits showing just commit message and files touched

whatup = !sh -c 'git whatchanged --pretty=format:%n%s --name-only -$1 > /w/logs/git.log' -
@randomecho
randomecho / dump.php
Last active Oct 3, 2015
Ugly dump of the variable used, needing something that was easily seen on the page
View dump.php
function dump($thevar, $killme = false)
{
echo "\n\n".'<pre style="text-align:left;color:#000;background:#fff;padding:1em;border:1px dotted #ccc;margin:1em 0;clear:both;">'."\n\n";
print_r($thevar);
if (is_object($thevar))
{
echo "\n\nmethods on this object";
print_r(get_class_methods($thevar));
}
@randomecho
randomecho / bash_profile
Last active Aug 29, 2015
Custom Git settings on a Mac OS bash prompt
View bash_profile
# ~/.bash_profile
export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"
# Auto-completion helper when you hit tab
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
View keybase.md

Keybase proof

I hereby claim:

  • I am randomecho on github.
  • I am randomecho (https://keybase.io/randomecho) on keybase.
  • I have a public key whose fingerprint is 119D F84C 21E4 E785 9C66 6D17 F21A BCE5 326C 3BC0

To claim this, I am signing this object:

@randomecho
randomecho / phpinfo-dump.php
Created Jun 27, 2014
Grab, strip and dump out phpinfo() into part of a page, neutering some of its overriding HTML and styles.
View phpinfo-dump.php
ob_start();
phpinfo();
$phpInfo = ob_get_clean();
$phpInfo = preg_replace('/600(px)?/', '100%', $phpInfo); // table and hr width
$phpInfo = str_replace('75%', '95%', $phpInfo); // font-size
$phpInfo = preg_replace('/<?([\w]|<|\/|>)*(a:|!DOCTYPE|<html|title|body)(.+)?\\n?/', '', $phpInfo); // main html doc tags