Skip to content

Instantly share code, notes, and snippets.

View lukeholder's full-sized avatar
👋

Luke Holder lukeholder

👋
View GitHub Profile
@lukeholder
lukeholder / timberline-sage-300.rb
Created July 8, 2014 04:45
Connect to Timberline Sage 300 from Ruby on Windows through ODBC using the Sequel Gem
require 'sequel'
connection_string = 'driver={Timberline Data};dbq=\\\\doric-server19\\Timberline Office\\Gold\\DORIC GROUP\\;codepage=1252;dictionarymode=0;standardmode=1;maxcolsupport=1536;shortenames=0;databasetype=1;uid=luke;pwd=Awesome;'
db = Sequel.odbc(:driver=>'Timberline Data',:drvconnect=>connection_string)
# I found this returns true sometimes even if the connection is not working.
puts db.test_connection
master_company = db.fetch('SELECT * FROM ABM_MASTER__COMPANY').all
class CellarSession implements \Cartalyst\Cart\Storage\StorageInterface
{
public function getKey()
{
return "cellar";
}
public function identify()
{
var randomNumbers = [42, 12, 88, 62, 63, 56, 1, 77, 88, 97, 97, 20, 45, 91, 62, 2, 15, 31, 59, 5]
func partition(v: Int[], left: Int, right: Int) -> Int {
var i = left
for j in (left + 1)..(right + 1) {
if v[j] < v[left] {
i += 1
(v[i], v[j]) = (v[j], v[i])
}
}
@lukeholder
lukeholder / download.bash
Last active August 29, 2015 14:01
How do download all cartslyst repos from the command line. no need to subscribe all the time
mkdir Cartalyst
cd Cartalyst
curl -s https://api.github.com/orgs/jenkinsci/repos | ruby -rjson -e 'JSON.load(STDIN.read).each {|repo| %x[git clone #{repo["ssh_url"]} ]}'
@lukeholder
lukeholder / file.csv
Created April 9, 2014 08:07
non standard csv file with comment lines
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 17 in line 1.
; This is a comment
DC,4470-001,,01-405,G,3,16/03/2014,16/03/2014,Payroll Costing 16/03/14,0,,468.02,,,101001,,
DC,4470-001,,01-405,G,3,16/03/2014,16/03/2014,Leave Accrual,0.57,,33.34,,,101001,,
; Another comment
DC,4470-001,,01-410,G,3,16/03/2014,16/03/2014,Payroll Costing 16/03/14,0,,4212.18,,,101001,,
DC,4470-001,,01-410,G,3,16/03/2014,16/03/2014,Leave Accrual,5.57,,325.66,,,101001,,
; Another comment
GL,16/03/2014,16/03/2014,Generated recovery,5039.20,110-60002-51-8002.001,,101001,,,,,,,,,
GL,16/03/2014,16/03/2014,Generated recovery,-5039.20,110-60002-51-6535.001,,101001,,,,,,,,,
GL,16/03/2014,16/03/2014,Payroll Costing 16/03/14,-2883.61,130-00000-00-3210.000,,101001,,,,,,,,,

Keybase proof

I hereby claim:

  • I am lukeholder on github.
  • I am luke (https://keybase.io/luke) on keybase.
  • I have the public key with fingerprint 1A94 E384 7341 0E2D 8B8F  73E2 32AF 990F C487 DB59

To claim this, I am signing this object:

@lukeholder
lukeholder / nav.twig
Last active December 24, 2015 03:19
craft nav
Template Syntax Error
Unexpected tag name "endifchildren" (expecting closing tag for the "nav" tag defined near line 24)
/Users/lukeholder/Code/Work/teninacraft/craft/templates/_partials/_topbar.html(24)
22 {% set pages = craft.entries.section('pages').find() %}
23 {% nav page in pages %}
24 <li class="{% ifchildren %}has-dropdown{% endifchildren %}">
@lukeholder
lukeholder / datafix.html
Created September 18, 2013 13:13
searching multiple times
>
{% set username = craft.request.getSegment(3) %}
{% set author = craft.users.username(username).first() %}
<p>Articles written by <strong>{{ author.firstName }} {{ author.lastName }}</strong></p>
{% paginate craft.entries.section('blog').limit(5).authorId(author.id) as entries %}
{% for entry in entries %}
<article>
<h1><a href="{{ entry.url }}">{{ entry.title }}</a></h1>
@lukeholder
lukeholder / _entry.html
Last active December 19, 2015 06:59
craft entry form
<form method="post" action="" accept-charset="UTF-8">
<input type="hidden" name="action" value="entries/saveEntry">
<input type="hidden" name="redirect" value="blog/{{ entry.slug }}">
<input type="hidden" name="entryId" value="{{ entry.id }}">
<input type="hidden" name="sectionId" value="1">
<input type="hidden" name="slug" value="{{ entry.slug }}">
<input type="hidden" name="enabled" value="1">
<label for="title">Title</label>
<input id="title" type="text" name="title" value="{{ entry.title }}">