Skip to content

Instantly share code, notes, and snippets.

@medvedev
medvedev / build.gradle
Last active October 23, 2023 16:56
Gradle task that prints total dependencies size and (dependency+(size in kb)) list sorted by size desc
...
/* Tested with Gradle 6.3 */
tasks.register("depsize") {
description = 'Prints dependencies for "default" configuration'
doLast() {
listConfigurationDependencies(configurations.default)
}
}
@yetanothernguyen
yetanothernguyen / mountain-lion-brew-setup.markdown
Created July 26, 2012 09:06 — forked from myobie/mountain-lion-brew-setup.markdown
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from http://developer.apple.com. You will not be able to submit apps to any stores using this XCode version, so turn away if that is something you might want to do.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@veganstraightedge
veganstraightedge / gist:2968906
Created June 21, 2012 22:13
expand comment box and show submit button on textarea focus
textarea {
height: 1.2em;
}
textarea:focus {
height: 4em;
}
.btn {
display: none;
@metaskills
metaskills / wait_until.rb
Last active May 2, 2024 01:51
Never sleep() using Capybara!
# WAIT! Do consider that `wait` may not be needed. This article describes
# that reasoning. Please read it and make informed decisions.
# https://www.varvet.com/blog/why-wait_until-was-removed-from-capybara/
# Have you ever had to sleep() in Capybara-WebKit to wait for AJAX and/or CSS animations?
describe 'Modal' do
should 'display login errors' do
visit root_path

Ruby Debugger

Most of the time simple output statements using warn, raise, or a logger will help you find your issue. But sometimes you need the big guns, and that means ruby-debug.

Ruby-Debug

The ruby-debug package has had some rocky times during the transition from Ruby 1.8.7 to 1.9.2 and beyond. But now, finally, the debugger is reliable and usable.

Installation

@bowsersenior
bowsersenior / sleep_sort.rb
Created June 16, 2011 00:33
Sleep sort in ruby
#!/usr/bin/env ruby
# Outputs sorted args to stdout
# from:
# http://dis.4chan.org/read/prog/1295544154/170
def sleep_sort(*args)
args.each { |e| fork { sleep(e.to_f/1000); puts e } }
end
sleep_sort(*ARGV)
@ngty
ngty / showoff-scraper.rb
Created June 4, 2011 17:49
Showoff's (https://github.com/schacon/showoff) builtin pdf conversion doesn't work well for me, so i hacked up my own version ... & it works !!
#!/usr/bin/env ruby
require 'rubygems'
require 'RMagick'
require 'capybara'
require 'capybara/dsl'
# ================================================================
# Collect input args
# ================================================================
begin
@bowsersenior
bowsersenior / stooge_loader.rb
Created May 18, 2011 23:18
A demo of YAML anchors, references and nested values
require 'rubygems'
require 'yaml'
# A demonstration of YAML anchors, references and handling of nested values
# For more info, see:
# http://atechie.net/2009/07/merging-hashes-in-yaml-conf-files/
stooges = YAML::load( File.read('stooges.yml') )
# => {
# "default" => {
JSCLASS_PATH = 'build/min';
require('./' + JSCLASS_PATH + '/loader');
JS.require('JS.Deferrable');
Promise = new JS.Class({
include: JS.Deferrable,
initialize: function(value) {
if (value !== undefined) this.succeed(value);
@bowsersenior
bowsersenior / cancan_mongoid.rb
Created September 2, 2010 00:42 — forked from blackgold9/mongoid_addtions.rb
How to get CanCan to work with Mongoid 2
module CanCan
class Query
def sanitize_sql(conditions)
conditions
end
end
# customize to handle Mongoid queries in ability definitions conditions
class CanDefinition
def matches_conditions_hash?(subject, conditions = @conditions)