Skip to content

Instantly share code, notes, and snippets.

Charles Roper charlesroper

View GitHub Profile
@charlesroper
charlesroper / gist:65931
Created Feb 17, 2009
Method to detect whether we are running from an elevated command-prompt under Vista/Win7 or as part of the local Administrators group in WinXP.
View gist:65931
#
# Method to detect whether we are running from an elevated command-prompt
# under Vista/Win7 or as part of the local Administrators group in WinXP.
#
def elevated?
whoami = `whoami /groups` rescue nil
if whoami =~ /S-1-16-12288/
true
else
admin = `net localgroup administrators | find "%USERNAME%"` rescue ""
View gist:158875
From ffc228ef071f2a0bac2838d8451ad1f07c090701 Mon Sep 17 00:00:00 2001
From: Charles Roper <charles.roper@gmail.com>
Date: Thu, 30 Jul 2009 20:38:04 +0100
Subject: [PATCH] Added option to command-line tool for wrapping attribs with double-quotes
---
lib/haml/exec.rb | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/lib/haml/exec.rb b/lib/haml/exec.rb
@charlesroper
charlesroper / tmsanitize4e.rb
Created Aug 12, 2009
A script to fix filenames that are incompatible with Windows.
View tmsanitize4e.rb
#!/usr/bin/ruby
# tmsanitize4e.rb
# A script to sanitize filenames that are incompatible with Windows.
require 'uri'
require 'find'
require 'fileutils'
include FileUtils::Verbose
View gist:175356
# refer to http://www.yaml.org/spec/1.1/ for clarification on YAML collections
non-semantic:
path: D:\Users\charlesr\Documents\My Dropbox\Code\CSS experiments\bp3col\non-semantic\css
custom_layout:
column_count: 16
column_width: 40
gutter_width: 20
semantic:
View gist:237136
> rake spec
(in D:/Temp/rad_s3)
Running Integration Spec Task
C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/bin/ruby.exe -I "C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/cucumber-0.3.99/lib;lib" "C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/cucumber-0.3.99/bin/cucumber" --format progress C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/radiant-0.8.1/features/admin/content_negotiation.feature C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/radiant-0.8.1/features/admin/layouts_management.feature C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/radiant-0.8.1/features/admin/pages_management.feature C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/radiant-0.8.1/features/admin/snippets_management.feature C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/radiant-0.8.1/feature
View gist:237155
> rake spec
(in D:/Temp/rad_s3)
Running Integration Spec Task
C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/bin/ruby.exe -I "C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/cucumber-0.3.99/lib;lib" "C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/cucumber-0.3.99/bin/cucumber" --format progress C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/radiant-0.8.1/features/admin/content_negotiation.feature C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/radiant-0.8.1/features/admin/layouts_management.feature C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/radiant-0.8.1/features/admin/pages_management.feature C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/radiant-0.8.1/features/admin/snippets_management.feature C:/Users/charlesr/Tools/Ruby/ruby-1.8.6-p383-i386-mingw32/lib/ruby/gems/1.8/gems/radiant-0.8.1/feature
@charlesroper
charlesroper / TaxonDeterminationUpdate.xml
Created Jan 14, 2010
Adds a determination to every occurrence of taxa found in a specified CSV. The taxa must be defined in a column called 'Taxon_Name'.
View TaxonDeterminationUpdate.xml
<?xml version="1.0" ?>
<!--
XML Batch Update by Mike Weideli of Littlefield Consultancy
http://www.lfield.co.uk
January 2010
Modifications by Charles Roper of Sussex Biodiversity Record Centre
http://sxbrc.org.uk
January 2010
View gist:277413
<?xml version="1.0" ?>
<!--
XML Batch Update by Mike Weideli of Littlefield Consultancy
http://www.lfield.co.uk
January 2010
Modifications by Charles Roper of Sussex Biodiversity Record Centre
http://sxbrc.org.uk
January 2010
View gist:284091
declare
@date_start as int, @date_end as int
set @date_start = dbo.LCToRataDie('01/01/2005')
set @date_end = dbo.LCToRataDie('31/12/2009')
select distinct
txo.TAXON_OCCURRENCE_KEY
,itn2.PREFERRED_NAME as TAXON
,itn2.COMMON_NAME
View gist:300223
TCC LE 11.00.40 Windows Vista [Version 6.0.6002]
Copyright 2010 Rex Conn & JP Software Inc. All Rights Reserved
[ C:\Users\charlesr ]
> pik sw
pik/batch_file.rb:18:in `read': Invalid argument - C:/Users/charlesr/Tools/bin/C:/Users/charlesr/Tools/bin/pik.bat (Errno::EINVAL)
from pik/batch_file.rb:18:in `initialize'
from pik/batch_file.rb:5:in `new'
from pik/batch_file.rb:5:in `open'
from pik/commands/command.rb:52:in `clean_gem_batch'
You can’t perform that action at this time.