Skip to content

Instantly share code, notes, and snippets.

@emileswarts
emileswarts / gist:6592488
Created September 17, 2013 10:16
ruby float string sort
irb(main):001:0> ar = ["6", "7", "9", "11.5", "6", "8.5"]
=> ["6", "7", "9", "11.5", "6", "8.5"]
irb(main):002:0> ar.sort!
=> ["11.5", "6", "6", "7", "8.5", "9"]
@emileswarts
emileswarts / gist:7984291
Created December 16, 2013 09:15
Vimium customizations
unmap x
map d removeTab
unmap X
map u restoreTab
unmap T
map T duplicateTab
unmap K
unmap gt
map en nextTab
unmap J
if x and (y or z)
if x and foo?
def foo?
y or z
sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
sudo /sbin/mkswap /var/swap.1
sudo /sbin/swapon /var/swap.1
# Arguments:
#
# $1 is the file
# $2 is the type - for those times when file magic isn't enough.
# I frequently get html mail that has no extension
# and file can't figure out what it is.
#
# Set to '-' if you don't want the type to be discerned.
# Many applications can sniff out the type on their own.
[2014-10-03 11:20:31] request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\DBALException: "An exception occurred while executing 'SELECT t0.id AS id1, t0.code AS code2, t0.created AS created3, t0.root AS root4, t0.lvl AS lvl5, t0.lft AS lft6, t0.rgt AS rgt7, t0.parent_id AS parent_id8, t0.discr FROM pim_catalog_category t0 WHERE t0.code = ? AND t0.discr IN ('category') LIMIT 1' with params ["ski_men_jackets"]: SQLSTATE[42S22]: Column not found: 1054 Unknown column 't0.discr' in 'field list'" at /home/vcap/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php line 91 {"exception":"[object] (Doctrine\\DBAL\\DBALException: An exception occurred while executing 'SELECT t0.id AS id1, t0.code AS code2, t0.created AS created3, t0.root AS root4, t0.lvl AS lvl5, t0.lft AS lft6, t0.rgt AS rgt7, t0.parent_id AS parent_id8, t0.discr FROM pim_catalog_category t0 WHERE t0.code = ? AND t0.discr IN ('category') LIMIT 1' with params [\"ski_men_jackets\"]:\n\nSQLSTATE[42S22]: Column not found: 1054 Unknown column 't0.
let barposition = "bottom"
set noautofocus "The opposite of autofocus; this setting stops sites from focusing on an input box when they load
set typelinkhints
let locale = "uk"
let hintcharacters = "arstenio"
let completionengines = ["google", "bing"]
let searchalias g = "google" "Create a shortcut for search engines. For example, typing ':tabnew g example' would act the same way as ':tabnew google example'
let mapleader = ","
unmap e
unmap d
MYSQL
When(/^I visit comment page (\d+)$/) do |page|
CacheSweeper.stub(expire_cache: nil)
CommentSweeper.any_instance.stub(clear_cache: nil)
10.times { News::Item.first.comments << FactoryGirl.build(:comment, published: true)
p News::Item.first.comments.where('published = ?', true).page(page).per(Comment.config.per_page).map(&:id)
en
=> [16, 15, 14]
Started POST "/en-us/referrals/signup/" for 10.0.2.2 at 2016-02-15 19:33:23 +0000
Processing by ReferrerController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"68MglbQSox6p4T8YkaAQcCg3fu5uaigrcZmlBMWrC5o=", "referral_program_referrer"=>{"name"=>"en", "last_name"=>"en", "email"=>"enseiseisei@iesisesie.com", "address_attributes"=>{"address_1"=>"en", "address_2"=>"en", "postal_code"=>"en", "city"=>"en", "spree_country_id"=>"20"}, "t_shirt_size"=>"W XS", "signup_language"=>"en"}, "button"=>"", "language"=>"en", "country"=>"us"}
Spree::Preference Load (0.6ms) SELECT `spree_preferences`.* FROM `spree_preferences` WHERE `spree_preferences`.`key` = 'spree/frontend_configuration/locale' ORDER BY `spree_preferences`.`id` ASC LIMIT 1
(0.3ms) BEGIN
Spree::Preference Exists (0.5ms) SELECT 1 AS one FROM `spree_preferences` WHERE (`spree_preferences`.`key` = BINARY 'spree/frontend_configuration/locale' AND `spree_preferences`.`id` != 21) LIMIT 1
SQL (0.4ms) UPDATE `spree_preferences` S