A Pen by Christopher Saunders on CodePen.
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
; COUNTER | |
JMP start | |
start: | |
CALL counter | |
counter: | |
POP D ; Avoid stack overflow | |
INC A ; A++ |
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
Dir[File.join('_site', '**', '*')].reject { |p| File.directory? p } | |
.reject { |filename| !filename[/\.html/] } | |
.each do |file| | |
main_css = File.read('_site/css/main.css') | |
old_contents = File.read(file) | |
new_contents = old_contents.gsub( | |
"<link href='css/main.css' rel='stylesheet'>", | |
"<style>#{main_css}</style>" | |
) | |
File.open(file, 'w') { |newfile| newfile.write(new_contents) } |
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 'zlib' | |
Dir[File.join('_site', '**', '*')].reject { |p| File.directory? p } | |
.each do |oldfile| | |
old_file_text = File.read(oldfile) | |
open(oldfile, 'wb') do |file| | |
gzip = Zlib::GzipWriter.new(file) | |
gzip << old_file_text | |
gzip.close | |
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 'uglifier' | |
Dir[File.join('_site', '**', '*')].reject { |p| File.directory? p } | |
.each do |file| | |
next unless file[/\.js/] | |
compressed = Uglifier.compile( | |
File.read(file) | |
) | |
File.open(file, 'w') { |newfile| newfile.write(compressed) } | |
puts "#{file} uglified." |
* * * * * cd /home/pi/Sites/testapp && /home/pi/.rvm/bin/rvm all do bundle exec rake sendemail:send >> /home/pi/Sites/testapp/log/cronlog.txt
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 'yaml' | |
puts YAML.load_file(ARGV[0].to_s).sort |
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
# functional but linter hates it | |
(1..100).map {|e| (e % 15).zero? ? "FizzBuzz": (e % 3).zero? ? "Fizz" : (e % 5).zero? ? "Buzz": e }.each {|e| puts e } |
http://en.wikipedia.org/wiki/Homoiconicity
(setq y '(+ (* 7 (expt x 3) (* x 9) 2 (cos (* 3 x)))))
Predicates - test if something is true.