Instantly share code, notes, and snippets.

# Mario Zigliottomariozig

• Sort options
Created Oct 24, 2019
Eric Log
View eric.log
Good use of emoji
View emoji.swift
 class 💩💩💩💩 { func 💩💩💩(😎: Int, 🐯: Int) -> Int { return 😎 + 🐯; } } let 🐔 = 3; let 😥 = 🐔 + 2; let 💩 = 💩💩💩💩(); print(💩.💩💩💩(😎:🐔, 🐯:😥)); // => "8\n"
Last active Oct 21, 2017
The result of using a refinement -- from post http://ruby.zigzo.com/2017/10/21/refinements-fancy-monkey/
View refinement_output.rb
 # Our code calling `to_s` on an Integer has been refined puts CrazyInteger.crazy_string(2) # => "TWO, ALWAYS TWO!!!!" puts CrazyInteger.crazy_string(3) # => "TWO, ALWAYS TWO!!!!" # Regular calls to Integer.to_s are still safe! puts 1.to_s # => "1" puts 2.to_s
Last active Oct 21, 2017
Something that should never be done... http://ruby.zigzo.com/2017/10/21/refinements-fancy-monkey/
View crazy_integer_refinement.rb
 module IntegerRefinements refine Integer do def to_s 'TWO, ALWAYS TWO!!!!' end end end class CrazyInteger using IntegerRefinements
Last active Oct 21, 2017
Refine the Integer class - http://ruby.zigzo.com/2017/10/21/refinements-fancy-monkey/
View integer_refinements.rb
 module IntegerRefinements refine Integer do def to_s 'TWO, ALWAYS TWO!!!!' end end end
Last active Oct 21, 2017
Bad idea to monkeypatch `.to_s` -- code for post: http://ruby.zigzo.com/2017/10/21/refinements-fancy-monkey/
 irb(main):001:0> 1.class => Integer irb(main):002:0> 1.to_s => "1" irb(main):003:0> class Integer irb(main):004:1> def to_s irb(main):005:2> "two" irb(main):006:2> end irb(main):007:1> end => :to_s
Created Dec 15, 2016 — forked from rwestergren/html_test.html
HTML Email Filter Test
View html_test.html

Last active Oct 10, 2015
Code for blog post: http://ruby.zigzo.com/2015/10/10/playing-with-crystal-lang/
View goodtimes.cr
 require "http/client" class Word def initialize(word) raise ArgumentError.new "Not a single word" if word.split(" ").size > 1 @word = word end def wiki_title wiki_page = WikipediaPage.new(@word)
Created Apr 26, 2015
Output of `docker images` used in post: http://ruby.zigzo.com/2015/04/26/docker-image-cleanup/
View docker-images-output.sh
 \$ docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE bloggy_web latest fd72d1901622 10 hours ago 912 MB a51a0506164a 10 hours ago 903.4 MB bloggy_square latest 4246ada965f2 10 hours ago 903.4 MB 6e1e68d610ba 10 hours ago 903.4 MB docker_square latest 85c7ac711d78 11 hours ago 808.9 MB postgres 9.4.1 03119fe33f25 4 days ago 213.9 MB ruby 2.2.1 ef6e4b7dc7cd 3 weeks ago 775.1 MB kirkdockerized_web latest 83edc1a1d29a 4 months ago 347.8 MB
Last active Aug 29, 2015 — forked from edelpero/heroku_rails_phantomjs.md
View heroku_rails_phantomjs.md

#Heroku, Ruby on Rails and PhantomJS

In this post, I’m going to show you how to modify an existing Ruby on Rails app running on Heroku’s Cedar stack to use PhantomJS for screen scraping. If you’ve never heard of PhantomJS, it’s a command-line WebKit-based browser (that supports JavaScript, cookies, etc.).

Let’s get started. This is a high-level overview of the required steps:

• Modify your app to use multiple Heroku buildpacks.
• Extend your app to use both the Ruby as well as the PhantomJS buildpacks.
• Confirm that everything worked.
You can’t perform that action at this time.