Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am lucasmazza on github.
  • I am lucasmazza (https://keybase.io/lucasmazza) on keybase.
  • I have a public key ASCwaqEHLhwg8aUXSmzTC2yROq1SQYQwGpjAU6L1zs6q9go

To claim this, I am signing this object:

(function($, QUnit){
QUnit.assert.hasSelector = function(node, selector) {
var el = $('<div>' + node.outerHTML + '</div>'),
ok = el.has(selector);
this.push(ok, el.html(), selector, "expected to have selector '" + selector +"'.");
};
QUnit.assert.hasLink = function(node, text, href) {
var el = $('<div>' + node.outerHTML + '</div>'),
@lucasmazza
lucasmazza / disabled-button.js
Last active September 16, 2015 01:43
DisabledButtonElement
const slice = Array.prototype.slice;
// Public: Custom `button` element that is enabled and disabled based on the
// validity state of the inputs inside the same 'form' element as the button.
//
// Example
//
// <form>
// <input name='name' required />
// <button is='disabled-button'>Click me after you fill in the input</button>
var PasteMessage = require('components/messages/paste'),
React = require('react');
function render(Component, props, callback) {
var element = React.createElement(Component, props),
root = document.createElement('div');
var component = React.render(element, root, function() {
setTimeout(function() {
callback(root.childNodes[0], component);
@lucasmazza
lucasmazza / test.js
Created May 23, 2015 02:35
QUnit + React, Capybara style.
var SoundMessage = require('components/formatters/sound'),
React = require('react');
function render(Component, props, callback) {
var element = React.createElement(Component, props),
root = document.createElement('div');
var component = React.render(element, root, function() {
setTimeout(function() {
callback(root.childNodes[0], component);
span { margin-top: 30px; padding: 20px; color: white; line-height: 20px; }
span { background-color:blue;}
span:nth-child(4) { background-color: red; }
diff --git a/lib/lol_dba.rb b/lib/lol_dba.rb
index d9a75a4..6a1e07e 100644
--- a/lib/lol_dba.rb
+++ b/lib/lol_dba.rb
@@ -125,13 +125,7 @@ EOM
else
# go to joining model through has_many and find belongs_to
blg_to_reflection = class_name.reflections[reflection_options.options[:through].to_s]
- if blg_to_reflection.options[:class_name]
- # has_many :class_name
@lucasmazza
lucasmazza / index.html
Created August 21, 2014 16:24
jquery-ujs #385
<!doctype html>
<html>
<head>
<meta charset='UTF-8'>
<title>Page title</title>
</head>
<body>
<form action='http://google.com' method='GET'>
<input name='q' placeholder='Search it'>
<button data-disable-with='Googling...'>Go to Google</button>
@lucasmazza
lucasmazza / 01.md
Last active August 29, 2015 14:03
Cleaning up 'assets:precompile' output

Current

$ bin/rake assets:precompile
I, [2014-06-26T13:03:52.746563 #45889]  INFO -- : Writing /Users/lucas/code/sandbox/thing/public/assets/application-768dbe43f3cf6f6cf2c49cfa3aa3e0cc.js
I, [2014-06-26T13:03:52.783363 #45889]  INFO -- : Writing /Users/lucas/code/sandbox/thing/public/assets/application-eafec6585cbffd518d28b50a42e53dd9.css

1 - Without severity/timestap/progname

unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'sqlite3'
GEMFILE
system 'bundle --quiet'