Skip to content

Instantly share code, notes, and snippets.

View hsuh's full-sized avatar
🦕

Hsu Hlaing hsuh

🦕
  • Edinburgh
  • 17:46 (UTC -12:00)
View GitHub Profile
@hsuh
hsuh / gist:8405170e27f1130ce107
Created October 2, 2014 11:49
capybara select by value
def select_by_value(id, value)
option_xpath = "//*[@id='#{id}']/option[@value='#{value}']"
option = find(:xpath, option_xpath).text
select(option, :from => id)
end
Save in a .rb file in spec/support/ (Optional)
Example use:
before do
@hsuh
hsuh / gist:4381cc0d5d1b8f75f864
Created October 30, 2014 10:11
if your rails console word wrap disappeared while on screen
it's probably screen
Ctrl + a
Ctrl + r
until it says +wrap
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@hsuh
hsuh / gist:f0c77bbe16392686d556
Created January 8, 2015 12:13
cygwin cd-ing into files and folders with spaces
e.g. cd Program*Files/
cd Program\ Files\ \(x86\)
In your .bashrc
alias cdc='cd /cygdrive/c'
alias cdp='cd /cygdrive/c/Program*Files/'
alias cdpx='cd /cygdrive/c/Program\ Files\ \(x86\)'
@hsuh
hsuh / gist:00e4ccd26be77d65c89f
Created January 12, 2015 12:20
Configuring git svn for a remote svn repository
Install git on Cygwin
Might be an error - Can’t locate Term/ReadKey.pm when running git svn clone ...
In that case do this:
-----------------------------------------
Install GCC-core, make for cygwin
Install Perl - Term::ReadKey through cygwin as well
-----------------------------------------
QUnit.begin(function(obj) {
console.log("Test amount:" + obj.totalTests);
});
QUnit.moduleStart(function (obj) {
console.log("##teamcity[testSuiteStarted name='" + obj.name + "']");
});
QUnit.moduleDone(function (obj) {
console.log("##teamcity[testSuiteFinished name='" + obj.name + "']");
@hsuh
hsuh / README.md
Last active October 19, 2022 04:53 — forked from pasela/README.md

A soft pastel color theme for mintty

This is ported version of color theme xoria256.

screenshot

Settings

Merge mintty-color-xoria256-rc into your .minttyrc

@hsuh
hsuh / gist:9f4d34f56ce32120e894
Created February 5, 2015 09:26
Adding Mintty to WebStorm 9.0.3
#if you haven't already
1. Install chere
#Run the line below in terminal
chere -i -t mintty -f
Add external tools on WebStorm(Settings):
Program: C:\cygwin64\bin\mintty.exe
var msiversion = function msieversion() {
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) // If Internet Explorer, return version number
{
return true;
} else { // If another browser,
return false;
}
return false;
@hsuh
hsuh / gist:f08c526c9c39e9646357
Last active August 29, 2015 14:15
Bash pattern matching
$ a=/cygdrive/c/projects/sandbox/projects
##match pattern from the left hand side. Double # means greedy.
hsuh@hsuh /cygdrive/c/projects/sandbox/projects
$ echo ${a##*sandbox}
/projects
##match pattern from the right hand side. Double % means greedy.
hsuh@hsuh /cygdrive/c/projects/sandbox/projects
$ echo ${a%%proj*}