Skip to content

Instantly share code, notes, and snippets.

View mariozig's full-sized avatar

Mario Zigliotto mariozig

  • Intuit
  • San Mateo, CA
View GitHub Profile
class Hangman
attr_accessor :words
def initialize
@words = []
@word = []
@hint = []
@guess = ""
@player = Player.new()
@computer = Computer.new()
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
@user.errors[:email].should include("is invalid") # check for the error format message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
# Do not refactor, it is a bad practice. YOLO
# Not understanding why or how something works is always good. YOLO
# Do not ever test your code yourself, just ask. YOLO
# No one is going to read your code, at any point don't comment. YOLO
# Why do it the easy way when you can reinvent the wheel? Future-proofing is for pussies. YOLO
devise = yes?("Devise? ")
cancan = yes?("Cancan? ")
omniauth = yes?("Omniauth? ")
foundation = yes?("Foundation? ")
bootstrap = foundation ? false : yes?("Bootstrap? ")
ember = yes?("Ember? ")
handlebars = ember ? false : yes?("Handlebars? ")
underscore = yes?("Underscore? ")
staticpages = yes?("Static Pages Controller with home page? ")
github = yes?("GitHub create and push? ")
@mariozig
mariozig / #10945
Last active December 23, 2015 06:29
Add additional assert that more clearly exposes the fact that ArtistsTrack's artistic_role_id is being lost
# Activate the gem you are reporting the issue against.
gem 'activerecord', '4.0.0'
require 'active_record'
require 'minitest/autorun'
require 'logger'
# This connection will do for database-independent bug reports.
# ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: 'shiz.db')
ActiveRecord::Base.logger = Logger.new(STDOUT)

#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.
@mariozig
mariozig / html_test.html
Created December 15, 2016 21:20 — forked from rwestergren/html_test.html
HTML Email Filter Test
<a onafterprint="console.log(244599)" onbeforeprint="console.log(309354)" onbeforeunload="console.log(879813)" onerror="console.log(949564)" onhashchange="console.log(575242)" onload="console.log(301053)" onmessage="console.log(976974)" onoffline="console.log(796090)" ononline="console.log(432638)" onpagehide="console.log(504345)" onpageshow="console.log(696619)" onpopstate="console.log(398418)" onresize="console.log(943097)" onstorage="console.log(882233)" onunload="console.log(929443)" onblur="console.log(932104)" onchange="console.log(102339)" oncontextmenu="console.log(761265)" onfocus="console.log(188946)" oninput="console.log(143653)" oninvalid="console.log(304208)" onreset="console.log(318472)" onsearch="console.log(778420)" onselect="console.log(942035)" onsubmit="console.log(603589)" onkeydown="console.log(650647)" onkeypress="console.log(579383)" onkeyup="console.log(821763)" onclick="console.log(284098)" ondblclick="console.log(477370)" ondrag="console.log(439095)" ondragend="console.log(546684)" o
@mariozig
mariozig / emoji.swift
Last active July 26, 2019 16:28 — forked from hasanadil/gist:96bad711d6f71ec806f7
Good use of emoji
class 💩💩💩💩 {
func 💩💩💩(😎: Int, 🐯: Int) -> Int {
return 😎 + 🐯;
}
}
let 🐔 = 3;
let 😥 = 🐔 + 2;
let 💩 = 💩💩💩💩();
print(💩.💩💩💩(😎:🐔, 🐯:😥)); // => "8\n"