Skip to content

Instantly share code, notes, and snippets.

View jamesballard's full-sized avatar

James Ballard jamesballard

  • Melbourne
  • 14:40 (UTC +10:00)
View GitHub Profile
# Load the library
library(ggplot2)
library(ggmap)
# Create a dummy data frame of points
set.seed(500)
df <- round(data.frame(
lon = jitter(rep( 77.59, 50), amount = .3),
lat = jitter(rep( 12.97, 50), amount = .3)
), digits = 2)
@amitkaps
amitkaps / Multi Variable Visualization
Created May 5, 2015 02:36
Moving up the ladder of multi variable visualisation (in R)
library(ggplot2)
?mpg
head(mpg)
str(mpg)
# Identify a scatter point
attach(mtcars)
plot(mpg, wt)
identify(x = mpg, y = wt, n = 3, label = row.names(mtcars))
detach(mtcars)
@jeffdgr8
jeffdgr8 / SumByColor.js
Last active December 15, 2018 22:25 — forked from clupasq/subByColor.js
function getBackgroundColor(rangeSpecification) {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
return sheet.getRange(rangeSpecification).getBackground();
}
function getForegroundColor(rangeSpecification) {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
return sheet.getRange(rangeSpecification).getFontColor();
}
@bjcull
bjcull / nav-wizard.bootstrap.css
Last active March 5, 2017 22:30
Wizard style navigation tabs for bootstrap
.nav-pills.nav-wizard > li {
position: relative;
overflow: visible;
border-right: 15px solid transparent;
border-left: 15px solid transparent;
}
.nav-pills.nav-wizard > li + li {
margin-left: 0;
}
.nav-pills.nav-wizard > li:first-child {
@mmdemirbas
mmdemirbas / gist:3656288
Created September 6, 2012 13:32
Aggresive MySql Stored Procedure Debugging
DECLARE E INT DEFAULT 0;
DECLARE M TEXT DEFAULT NULL;
DECLARE CONTINUE HANDLER FOR 1000 SET E='1000', M="hashchk";
DECLARE CONTINUE HANDLER FOR 1001 SET E='1001', M="isamchk";
DECLARE CONTINUE HANDLER FOR 1002 SET E='1002', M="NO";
DECLARE CONTINUE HANDLER FOR 1003 SET E='1003', M="YES";
DECLARE CONTINUE HANDLER FOR 1004 SET E='1004', M="Can't create file '%s' (errno: %d)";
DECLARE CONTINUE HANDLER FOR 1005 SET E='1005', M="Can't create table '%s' (errno: %d)";
DECLARE CONTINUE HANDLER FOR 1006 SET E='1006', M="Can't create database '%s' (errno: %d)";
@jasny
jasny / mysql_splitdump.sh
Last active February 15, 2024 16:13
Split MySQL dump SQL file into one file per table or extract a single table
#!/bin/bash
####
# Split MySQL dump SQL file into one file per table
# based on http://blog.tty.nl/2011/12/28/splitting-a-database-dump
####
if [ $# -lt 1 ] ; then
echo "USAGE $0 DUMP_FILE [TABLE]"
exit
@nexeck
nexeck / git_history.php
Created November 24, 2011 15:01 — forked from geeknam/git_history.php
Parse git log with PHP to an array
<?php
// Author: Ngo Minh Nam
$dir = "/path/to/your/repo/";
$output = array();
chdir($dir);
// Linux
exec("git log",$output);
// Windows
exec('"C:\Program Files (x86)\Git\bin\git.exe" ' ."log", $output);
@geeknam
geeknam / git_history.php
Created May 8, 2011 16:43
Parse git log with PHP to an array
<?php
// Author: Ngo Minh Nam
$dir = "/path/to/your/repo/";
$output = array();
chdir($dir);
exec("git log",$output);
$history = array();
foreach($output as $line){
if(strpos($line, 'commit')===0){
@junichi11
junichi11 / cake_helper_code_completion.php
Created April 21, 2011 11:20
CakePHP Helper Code Completion
<?php
/**
* CakePHP Helper Code Completion
* @author junichi11
*
* install NetBeans 7.0 && cakephp-netbeans plugin
* http://netbeans.org
* https://github.com/evilbloodydemon/cakephp-netbeans/tree/autocomplete
* /path/to/yourproject/nbproject/cake_helper_code_completion.php
*
@neilernst
neilernst / query_cite.rb
Created September 4, 2010 19:34
Find citation keys using Mendeley
#!/usr/bin/ruby
require 'sqlite3'
cite_part = ARGV[0]
db_name = "/Users/nernst/Library/Application\ Support/Mendeley\ Desktop/neil\@neilernst.net\@www.mendeley.com.sqlite"
db = SQLite3::Database.new( db_name )
db.results_as_hash = true
query = "select citationkey, title, year from Documents where citationkey like '%#{cite_part}%'"#MATCH '#{cite_part}'"#{}like '%#{cite_part}%'"
db.execute( query ) do |row|
print row['citationKey'] + '|'