Skip to content

Instantly share code, notes, and snippets.

Avatar
🚽
Developer

Soon Van randomecho

🚽
Developer
View GitHub Profile
@randomecho
randomecho / ruby-on-windows.md
Last active Dec 17, 2015
Workarounds and reminders for Ruby development on Windows (Vista at least)
View ruby-on-windows.md

Bloody hell is Ruby on Rails development on Windows an exercise in chasing through search engines.

database configuration does not specify adapter

"database configuration does not specify adapter" error with PG gem in Rails 3.2

@randomecho
randomecho / australian-postcodes.sql
Last active Jul 22, 2021
Australian postcodes (with states and suburb names) geocoded with latitude and longitude.
View australian-postcodes.sql
/*
Taken and cribbed from blog.datalicious.com/free-download-all-australian-postcodes-geocod
May contain errors where latitude and longitude are off. Use at own non-validated risk.
*/
SET NAMES utf8;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS postcodes_geo;
@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 / snipper.php
Last active Dec 16, 2015
Strip down a chunk of formatted text to use for META description tag.
View snipper.php
/**
* Render text with possible markup into snippet of plain text chunk
* suitable for meta description tag or other display area that
* may not like HTML tags or Markdown formatting.
*
* @author Soon Van - randomecho.com
* @copyright 2013 Soon Van
* @license http://www.opensource.org/licenses/BSD-3-Clause
*
* @param string raw text with possible formatting
@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));
}