Skip to content

Instantly share code, notes, and snippets.

View rosskevin's full-sized avatar

Kevin Ross rosskevin

View GitHub Profile
@rosskevin
rosskevin / ElasticSearch.sh
Last active August 29, 2015 14:16 — forked from ricardo-rossi/ElasticSearch.sh
CLI version - java8
### ElasticSearch version
if [ -z "$1" ]; then
echo ""
echo " Please specify the Elasticsearch version you want to install!"
echo ""
echo " $ $0 1.4.0"
echo ""
exit 1
fi
sysbench --test=fileio --file-total-size=2G prepare
sysbench --test=fileio --file-total-size=2G --file-test-mode=rndrw --init-rng=on --max-time=300 --max-requests=0 run
sysbench --test=fileio --file-total-size=2G cleanup
@rosskevin
rosskevin / bundle_engines.rb
Last active October 1, 2015 19:59
Bundle Gemfile hack for working with rails engines both locally and otherwise - symlinks directory when in local developer mode.
#----------------------------------------------------------------------
#
# Load all engines
#
# Sample hash - Add to your Gemfile:
# # Load all engines
# @engines = {
# acme: {git: 'git@bitbucket.org:alienfast/acme.git'}
# }
# eval_gemfile File.expand_path 'bundle_engines.rb', File.dirname(__FILE__)
@rosskevin
rosskevin / Rakefile
Last active October 28, 2015 10:41
Rakefile - less to sass a.k.a. less2sass or less2scss
# less to scss based on http://stackoverflow.com/a/19167099/2363935
namespace :convert do
task :less_to_scss do
source_glob = "assets/less/*.less"
dest_dir = "converted"
rm_r dest_dir rescue nil
mkdir_p(dest_dir)
sudo mount /dev/nvme0n1p3 /mnt
sudo mount /dev/nvme0n1p1 /mnt/boot/efi
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
#sudo cp --remove-destination /etc/resolv.conf /mnt/etc/resolv.conf
sudo chroot /mnt
grub-install --efi-directory=/boot/efi --target=x86_64-efi --uefi-secure-boot /dev/nvme0n1
exit
@rosskevin
rosskevin / step_definitions-fill_in_blank
Last active December 19, 2015 14:48
Cucumber Capybara fill_in '' triggering client_side_validations. I fill in happy path values in the Background, and use Scenario Outline examples to create invalid submissions. This will properly trigger validations for both :selenium (firefox and chrome) and :webkit (capybara-webkit) drivers. Note that this is recently changed in capybara >= 2.…
When /^I fill in "([^"]*)" with "([^"]*)"$/ do |field, value|
# special - if ! ignore filling in
if value.eql? '!'
return
else
f = find_field(field)
current_value = f.value
# fill in unless it is already the same, then just leave it as-is
@rosskevin
rosskevin / AnchorDisabler
Created October 16, 2014 20:49
AnchorDisabler.coffee - disable links once and for all with a.disabled or the disabled attribute
class AnchorDisabler
###
This provides for multiple levels of defense so that Anchors marked as disable actually behave as such.
Using this approach, you get an anchor that you cannot:
- click
- tab to and hit return
- tabbing to it will move focus to the next focusable element
- it is aware if the anchor is subsequently enabled
@rosskevin
rosskevin / es2015-rollup-import-chai.js
Last active April 18, 2016 20:48
This is the failed output of rollup for the statement `import {expect} from 'chai'` - bad options for global?
/*
Rollup messages:
[15:45:47] Treating 'buffer' as external dependency
[15:45:48] No name was provided for external module 'buffer' in options.globals – guessing 'require$$0'
index.js
import {expect} from 'chai'
chai - chai@3.5.0
// @flow
import React, {Component, PropTypes} from 'react'
import {withRouter} from 'react-router'
import {security} from '../../../lib/security/security'
import Form from 'react-formal'
import yup from 'yup'
import Helmet from 'react-helmet'
import Logger from '../../../lib/util/logger'
import autobind from 'autobind-decorator'
// @flow
import React, {Component, Element} from 'react'
import {withRouter} from 'react-router'
import {security} from '../../../lib/security/security'
import Form from 'react-formal'
import yup from 'yup'
import Helmet from 'react-helmet'
import Logger from '../../../lib/util/logger'
import autobind from 'autobind-decorator'