Skip to content

Instantly share code, notes, and snippets.

require 'erb'
def get_items()
['bread', 'milk', 'eggs', 'spam']
end
def get_template()
%{
<DOCTYPE html "-//W3C//DTD 1.0 //EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@joelbyler
joelbyler / gist:3943185
Created October 24, 2012 01:34
Cucumber formatter notes
https://github.com/cucumber/cucumber/wiki/Custom-Formatters
https://github.com/raldred/cucumber_textmate/blob/master/textmate_formatter.rb
https://github.com/versapay/viewcumber/blob/master/lib/viewcumber.rb
@joelbyler
joelbyler / gist:3946336
Created October 24, 2012 14:20
watir-webdriver hack (maybe only a problem on Windows 7)
# Original solution found as part of this discussion:
# http://code.google.com/p/selenium/issues/detail?id=4020
# This is a monkey patch (aka HACK!) to get watir-webdriver to run on Windows 7.
# This works with watir-webdriver v0.6.1 / selenium-webdriver v2.25.x and may need to be revisited when using later versions
module Selenium
module WebDriver
module Platform
module_function
@joelbyler
joelbyler / gist:4033839
Created November 7, 2012 19:32
cool commands (at least I think they're cool)
# Find 'after_' in all files with a .rb file extension on OSX
find . -name *.rb | xargs grep "after_"
# kill all isntances of iexplorer.exe on windows
taskkill /f /im "iexplore.exe"
@joelbyler
joelbyler / gist:4042597
Created November 8, 2012 23:30
Automatically run tests in visual studio using MSTEST and Post Build Event
//Put this in your project properties Compile tab under Build Events...
//From Project to Build Test Project (replace 'Project Tests' with your actual test project name)
CD "$(SolutionDir)\Project Tests\$(OutDir)\"
"$(DevEnvDir)MSTEST.exe" /testcontainer:"Project Tests.dll"
//When test project is built
CD "$(TargetDir)"
"$(DevEnvDir)MSTEST.exe" /testcontainer:"$(TargetFileName)"
@joelbyler
joelbyler / trimmer.bat
Created November 25, 2012 23:07
Remove leading zeroes from all files in current directory
@echo off
SetLocal EnableDelayedExpansion
for %%a in (*) do (
call :DeleteLeadingZeros %%a
if not exist !NewName! (ren %%a !NewName!)
)
exit /b
:DeleteLeadingZeros %1
for /f "tokens=* delims=0" %%a in ("%1") do (set NewName=%%a)
@joelbyler
joelbyler / gist:4225565
Created December 6, 2012 15:57
Cucumber Rerun Rake Task
require 'cucumber/rake/task'
def run_rake_task(name)
begin
Rake::Task[name].invoke
rescue Exception => e
return false
end
true
end
@joelbyler
joelbyler / gist:4227050
Created December 6, 2012 18:51
Cleveland GDCR Slides
https://docs.google.com/presentation/pub?id=19WUpckSOMRVyIhKuD9z7x4lYWq5JzF5swZYCVNPjf0I&start=true&loop=true&delayms=1000#slide=id.g17779a8_1_104
@joelbyler
joelbyler / javascript-editor-tab
Last active December 12, 2015 02:38
JavaScript Notepad Bookmarklet
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/twilight");e.getSession().setMode("ace/mode/javascript");</script>
@joelbyler
joelbyler / gist:4707045
Created February 4, 2013 14:35
Lock your windows desktop from the command line.
rundll32.exe user32.dll, LockWorkStation