Skip to content

Instantly share code, notes, and snippets.

@handerson
handerson / mysqlfix.sh
Created March 27, 2012 16:52 — forked from davejlong/mysql client
How to setup the MySQL client and MySQLDump client on Mac OS x from MySQL Workbench
#MySQL Client
ln -s /Applications/MySQLWorkbench.app/Contents/Resources/mysql /usr/bin/mysql
#MySQL Dump
ln -s /Applications/MySQLWorkbench.app/Contents/Resources/mysqldump /usr/bin/mysqldump
#How to fix the "Library not loaded: libmysqlclient.18.dylib (LoadError)" error
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
<% const flattenPublicJSON = (obj = {}, res = [], extraKey = '/') => {
for(key in obj){
if(Array.isArray(obj[key])){
flattenPublicJSON(obj[key], res, `${extraKey}`);
}else if(key === '_contents'){
res.push(`${extraKey}/${obj[key]}`);
} else if(key === '_data'){
//ignore
} else if(typeof obj[key] !== 'object'){
res.push(`${extraKey}${obj[key]}`);
@handerson
handerson / LICENSE
Created May 15, 2012 16:19
a very basic Pubmed search API in ruby
Copyright (c) 2012 Heath Anderson
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE O
@handerson
handerson / rom_name_fix.rb
Created August 27, 2016 03:14
Fixes NDS rom names for use with R4 cards
#!/usr/bin/env ruby
require 'optparse'
options = {}
OptionParser.new do |opts|
opts.on('-d n', '--directory=n', 'Set Directory') do |d|
options[:directory] = d
end
opts.on('-h', '--help', 'Displays Help') do
require 'gollum/frontend/app'
require 'digest/sha1'
class App < Precious::App
User = Struct.new(:name, :email, :password_hash)
before { authenticate! }
helpers do
def authenticate!
@handerson
handerson / simplepolling.js
Created July 27, 2010 16:28
Simple AJAX Polling jQuery Plugin
//Simple AJAX Polling jQuery Plugin
// example usage:
/* $.ajaxPoll({
url: "/path",
type: "GET",
interval: 250,
maxAttempts: 25,
successCondition: function(result) {
return result != "processing";
},
@handerson
handerson / sqlite_backup_to_cloudfiles.rb
Created February 17, 2012 00:39
Creates a backup SQLite DB and backs it up to Rackspace Cloudfiles and maintains 14 days worth of backups
require 'rubygems'
require 'cloudfiles'
require 'sqlite3'
cf = CloudFiles::Connection.new(:username => "", :api_key => "")
original = = SQLite3::Database.new('/var/www/project/current/db/original.db')
backup = SQLite3::Database.new('/home/deploy/backup.sqlite3')
backup_process = SQLite3::Backup.new(backup, 'main', original, 'main')
@handerson
handerson / mysql_backup_to_cloudfiles.rb
Created February 17, 2012 00:24
Creates a MySQL dump and backs it up to Rackspace Cloudfiles and maintains 14 days worth of backups
require 'rubygems'
require 'cloudfiles'
cf = CloudFiles::Connection.new(:username => "", :api_key => "")
`mysqldump -u root --password=password --all-databases > /home/deploy/backup.sql`
file = File.new("/home/deploy/backup.sql")
if file
body {
background-color: #C5CCD6; /* Background color */
color: #222; /* Foreground color used for text */
font-family: Helvetica;
font-size: 14px;
margin: 0; /* Amount of negative space around the outside of the body */
padding: 0; /* Amount of negative space around the inside of the body */
-webkit-user-select: none;
overflow-x: hidden;
}
@handerson
handerson / .gitignore
Created September 2, 2011 14:37
My standard git ignore file for Ruby on Rails or Phonegap (or pretty much all projects)
# RoR/Padrino
log/**/*
api/log/**/*
tmp/**/*
api/tmp/**/*
bin/*
vendor/gems/*
!vendor/gems/cache/
.sass-cache/*
*.sqlite3