This file contains hidden or 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 'rbosa' | |
song = OSA.app('iTunes').current_track.name.gsub(/\(.*\)/, '').gsub(/\s/,'%20') | |
system("open -a Safari http://www.google.com/search?q=#{song}+lyrics") |
This file contains hidden or 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
#!/usr/bin/ruby -W0 | |
=begin | |
Quick and dirty way to tweet the currently active | |
Safari tab (title + shortened URL). Hashtags get | |
passed in as parameters (the hash sign gets added | |
by the script, so don't do it yourself) | |
Adapt to your needs! | |
=end |
This file contains hidden or 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
my @l = 'aoc-expenses.txt'.IO.lines; | |
# part 1 | |
say [*] @l.combinations(2).first: *.sum == 2020; | |
# part 2 | |
say [*] @l.combinations(3).first: *.sum == 2020; |
This file contains hidden or 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
### Keybase proof | |
I hereby claim: | |
* I am citizen428 on github. | |
* I am citizen428 (https://keybase.io/citizen428) on keybase. | |
* I have a public key whose fingerprint is E183 E826 AAA2 71D9 A25E B8E9 EF16 E5E6 87B2 A218 | |
To claim this, I am signing this object: |
This file contains hidden or 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 Kernel | |
def with(obj, &block) | |
obj.instance_eval &block | |
obj | |
end | |
end |
This file contains hidden or 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
import Foundation | |
extension Array { | |
func each(task: (Element) -> ()) { | |
for element in self { | |
task(element) | |
} | |
} | |
func eachWithIndex(start: Int? = nil, task: (Int, Element) -> ()) { |
This file contains hidden or 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
class EvenNumbers: CollectionType { | |
let startIndex : Int | |
let endIndex : Int | |
init(start: Int, end: Int) { | |
self.startIndex = start | |
self.endIndex = end | |
} | |
convenience init() { |
This file contains hidden or 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
@-moz-document url(http://derstandard.at/) { | |
div.section.inland { display: none } | |
} |
This file contains hidden or 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
class Proc | |
def prim_call(stack) | |
forth_arity = self.arity - 1 | |
if stack.size < forth_arity | |
puts "Buffer underrun" | |
return stack.clear | |
end | |
forth_arity > 0 ? self.call(stack, *stack.pop(forth_arity)) : call(stack) | |
end | |
end |
This file contains hidden or 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 'open-uri' | |
require 'nokogiri' | |
require 'builder' | |
html = open("https://github.com/languages/Ruby/created") | |
doc = Nokogiri::HTML.parse(html) | |
atom = Builder::XmlMarkup.new(:target => STDOUT, :indent => 2) | |
atom.instruct! | |
atom.feed "xmlns" => "http://www.w3.org/2005/Atom" do |
NewerOlder