Skip to content

Instantly share code, notes, and snippets.

Ken Collins metaskills

Block or report user

Report or block metaskills

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:540999
# encoding: utf-8
require 'odbc'
require 'odbc_utf8'
GC.disable
module ODBC
class Statement
def finished?
View sam.el
(global-set-key (kbd "M-s") 'save-buffer)
(global-set-key (kbd "M-z") 'undo)
(global-set-key (kbd "<escape>") 'hippie-expand)
(set-face-font 'default "-apple-inconsolata-medium-r-normal--13-0-72-72-m-0-iso10646-1")
(add-to-list 'default-frame-alist '(width . 100))
(add-to-list 'default-frame-alist '(height . 45))
(setq-default tab-width 2)
View gist:559402
Setting Up A Local Port Repo:
http://journal.bitshaker.com/articles/2007/10/20/install-old-versions-of-ports-using-macports/
http://trac.macports.org/wiki/howto/InstallingOlderPort
1) Add this to /opt/local/etc/macports/sources.conf
file:///Users/kencollins/Repositories/ports [nosync]
2) mkdir /Users/kencollins/Repositories/ports
View gist:562465
Topic.columns_hash['written_on'].sql_type # => "datetime"
Topic.columns_hash['bonus_time'].sql_type # => "time"
Topic.columns_hash['last_read'].sql_type # => "date"
Topic.count # => 4
data = Topic.connection.send(:select,"SELECT `topics`.* FROM `topics`")
row = data[0]
row['written_on'] # => 2003-07-16 10:28:11 UTC
row['written_on'].class # => Time
View gist:605209
# result = @client.execute('SELECT 1 AS [one]')
# result.cancel
# result.cancel
write.c:136:tds_put_string converting 17 bytes of "SELECT 1 AS [one]"
write.c:164:tds_put_string wrote 34 bytes
util.c:162:Changed query state from QUERYING to PENDING
net.c:779:Sending packet
View gist:621473
[datetime] => SYBDATETIME
61 1753-01-01T00:00:00.000 y:1753, m:1, d:1 h:0, m:0, s:0 MS:0 tz:1550134876
62 9999-12-31T23:59:59.997 y:9999, m:12, d:31 h:23, m:59, s:59 MS:997 tz:1550134876
63 2010-01-01T12:34:56.123 y:2010, m:1, d:1 h:12, m:34, s:56 MS:123 tz:1744847616
[smalldatetime] => SYBDATETIME4
231 1901-01-01T15:45:00.000Z days:365 minutes:945 (since 1/1/1900, since midnight)
232 2078-06-05T04:20:00.000Z days:65169 minutes:260 "
[datetime2_7] => SYBCHAR
71 0001-01-01T00:00:00.0000000Z 0001-01-01 00:00:00.0000000
View datedebug.rb
Time.utc(1999, 12, 30, 23, 45, 00, 123000).strftime("%L") # => "123"
Time.utc(1999, 12, 30, 23, 45, 00, 123000).strftime("%3N") # => "123" millisecond (3 digits)
Time.utc(1999, 12, 30, 23, 45, 00, 123000).strftime("%6N") # => "123000" microsecond (6 digits)
Time.utc(1999, 12, 30, 23, 45, 00, 123000).strftime("%9N") # => "123000000" nanosecond (9 digits)
Time.utc(1999, 12, 30, 23, 45, 00, 123000).to_f # => 946597500.123
Time.utc(1999, 12, 30, 23, 45, 00, 123000).usec # => 123000
require 'date'
require 'rational'
View query_mysql.rb
ejb-mbp2:activerecord-sqlserver-adapter ebryn$ ruby test/benchmark/query_sqlserver.rb
-- create_table(:test_benchmarks, {:force=>true})
-> 0.0715s
Query Sqlserver
===============
Author: Erik Bryn
Date: October 19, 2010
Summary: Benchmark SQL Server Queries
System Information
View gist:649413
# Using MacPort libs for all RVM rubie installs.
export CC='/usr/bin/gcc-4.2'
export CFLAGS='-O2 -arch x86_64'
export LDFLAGS='-L/opt/local/lib'
export CPPFLAGS='-I/opt/local/include'
rvm install saidrubie -C --with-opt-dir=/opt/local
@cowboy
cowboy / HEY-YOU.md
Last active May 29, 2019
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
You can’t perform that action at this time.