This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Watir | |
class Element | |
def on_screen? | |
windowHeight = browser.execute_script('return window.innerHeight') | |
elementRect = browser.execute_script('return arguments[0].getBoundingClientRect()', self) | |
elementTop = elementRect["top"] | |
return elementTop >= 0 && elementTop < windowHeight | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(?:Hibernate: )|(( )(?:(?:\S)+ as (?:\S)+,?|\b(and|or|on))|\b(select|from|where|(?:inner|left) ?(?:outer )?join)\b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pbcopy input | |
input.to_s.tap do |value| | |
IO.popen('pbcopy', 'w') { |clipboard| clipboard << value } | |
end | |
end | |
def pbpaste | |
puts `pbpaste` | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# see .irbrc here: https://gist.github.com/tncbbthositg/96bfaf644172595960eb | |
current_directory = File.dirname __FILE__ | |
file = File.join current_directory, ".irbrc" | |
load file | |
Pry.config.commands.command 'pbcopy', 'Copy value to clipboard' do |input| | |
pbcopy input.to_s | |
end | |
Pry.config.commands.command 'pbpaste', 'Paste value from clipboard' do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias st="git status" | |
alias be="bundle exec" | |
alias ber="be rake" | |
alias srsly='eval "sudo `history -p \!\!`"' | |
alias yolo='srsly' | |
kill_all() { | |
ps aux | grep $1 | grep -v grep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[core] | |
safecrlf = true | |
pager = "less -FX" | |
excludesFile = ~/.gitignore | |
[alias] | |
co = checkout | |
ci = commit | |
st = status | |
pr = pull --rebase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin flex($flex-type: flex) { | |
$flex-type: unquote($flex-type); | |
@include experimental-value(display, $flex-type, not -moz, -webkit, not -o, -ms, not -khtml, official); | |
} | |
@mixin align-items($alignment) { | |
$alignment: unquote($alignment); | |
@include experimental(align-items, $alignment, not -moz, -webkit, not -o, -ms, not -khtml, official); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Put this in application.rb, or in a rake task initialize code | |
if defined?(Rails) && (Rails.env == 'development') | |
Rails.logger = Logger.new(STDOUT) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IQueryable<T> WhereAny<T>(this IQueryable<T> source, params Expression<Func<T, bool>>[] predicates) | |
{ | |
Expression<Func<T, bool>> filter = t => false; | |
foreach (var predicate in predicates) | |
filter = filter.Combine(Expression.OrElse, predicate); | |
return source.Where(filter); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script>alert('');</script> |