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
const potentialNumbers = [ | |
null, | |
undefined, | |
'', | |
'x', | |
1, | |
1.0, | |
'1', | |
' 1', | |
'1 ', |
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
wget -r -E -H -Dwww.filmtage-bayerischer-schulen.de,ajax.googleapis.com -p -e robots=off -k http://www.filmtage-bayerischer-schulen.de/ |
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 with_last(enumerable, length = enumerable.length) | |
Enumerator.new do |yielder| | |
enumerable.each_with_index do |element, index| | |
yielder.yield(element, index == length - 1) | |
end | |
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
license: gpl-3.0 |
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
puts "Starting..." | |
forks = 10.times.map do |i| | |
fork do | |
puts "In fork #{i}" | |
sleep(i) | |
puts "End fork #{i}" | |
end | |
end.to_a |
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
require 'csv' | |
require 'nokogiri' | |
filename = "timeentries" | |
doc = File.open("#{filename}.xml") { |f| Nokogiri::XML(f) } | |
entries = doc.css('time-entry') | |
CSV.open("#{filename}.csv", "wb") do |csv| |
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 a_random_method_not_defined_in_a_class | |
puts self.class # outputs ExampleClass | |
puts @a_private_member # works | |
end | |
class ExampleClass | |
def initialize(a_private_member) | |
@a_private_member = a_private_member | |
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
git log -i --format=oneline | sed -n '/.*[Mm]ake \(.*\) great again.*/ s//\1/p' | |
# Or even: | |
git log -i --format=oneline | sed -n '/.*[Mm]ake \(.*\) great again.*/ s//\1/p' | ruby -ne 'BEGIN{a=[]};a<<$_.strip;END{puts a.join(", ")}' | |
# A bit shorter and maybe more performant (so use this if you want to make many things great again, e.g. the whole of america): | |
git log -i --format=oneline | sed -n '/.*[Mm]ake \(.*\) great again.*/ s//\1/p' | ruby -ne 'print ", " if $.!=1;print $_.strip;END{puts}' |
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
ls | awk 'NR%50!=25' | xargs rm |
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
#!/bin/bash | |
set -e | |
MAIN=${2:-development} | |
OPEN=open | |
MRS=$(git remote show -n origin | sed -n '/^ Fetch URL: git@\(.*\):\(.*\)\.git$/ s//https:\/\/\1\/\2\/merge_requests\//p') | |
if [ -z "$1" ] |