Skip to content

Instantly share code, notes, and snippets.

View Dkendal's full-sized avatar

Dylan C. Kendal Dkendal

View GitHub Profile
@Dkendal
Dkendal / gist:5785803
Created June 14, 2013 22:35
migrate mysql to innodb
DATABASE='NAME'
echo 'SHOW TABLES;' \
| mysql -u root ${DATABASE} \
| awk '!/^Tables_in_/ {print "ALTER TABLE `"$0"` ENGINE = InnoDB;"}' \
| column -t \
| mysql -u root ${DATABASE}
@Dkendal
Dkendal / mixin.scss
Created October 11, 2013 23:04
Compass rails Sass mixin for resizing sprite
@mixin scale-sprite($map, $sprite, $scale : 1) {
$sprite-file: sprite-file($map, $sprite);
$width-to-map-ratio: sprite-map-width($map)/image-width($sprite-file);
$pos: sprite-position($map, $sprite, 0, 0);
$height: image-height($sprite-file) * $scale;
$width: image-width($sprite-file) * $scale;
$x: nth($pos, 1) * $scale;
$y: nth($pos, 2) * $scale;
@Dkendal
Dkendal / gist:9400281
Created March 6, 2014 21:41
commits on a certain day function
#/bin/zsh
function git-what-did-i-do-x-days-ago() {
git log --since="6 am $1 days" --after="12 am $1 days" #formatting tags etc
}
@Dkendal
Dkendal / .tidyrc
Last active August 29, 2015 14:00
tidy config
bare: yes
break-before-br: yes
clean: yes
fix-uri: yes
#indent-attributes: yes
indent-spaces: 2
indent: yes
logical-emphasis: yes
markup: yes
output-xhtml: yes
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.log,*.sqlite3,public/assets/*
function! SwapLightAndDarkColorscheme()
if g:colors_name == 'solarized'
colorscheme molokai
elseif g:colors_name == 'molokai'
colorscheme solarized
endif
endfunction
command! SwapColors :call SwapLightAndDarkColorscheme()
@Dkendal
Dkendal / ag-operator.vim
Created May 16, 2014 20:01
A vim operator function to search for a word with a motion
nnoremap <leader>g :set operatorfunc=AgOperator<cr>g@
vnoremap <leader>g :<c-u>call AgOperator(visualmode())<cr>
function! AgOperator(type)
if a:type ==# 'v'
normal! `<v`>y
elseif a:type ==# 'char'
normal! `[v`]y
else
return
require 'spec_helper'
describe DietSearcher, type: :model do
let(:params) do
{ 'per_page' => '',
'product_search_form' => { 'allergens_ids' => ['1'] } }
end
describe 'Spree searcher intergration', type: :controller do
let(:vegan_cookies) { create :wellness_product }
let g:projectiles= {
\ 'Gemfile' : {
\ 'app|lib' : {
\ 'dispatch': "bundle exec rspec #",
\ },
\ '*_spec.rb' : {
\ 'dispatch': "bundle exec rspec {file}",
\ 'make' : "bundle exec rspec",
\ 'start' : "bundle exec rescue rspec {file}"
\ }
nnoremap <space><insert> :execute('Start bundle exec rescue rspec %:' . line('.'))<CR>