Skip to content

Instantly share code, notes, and snippets.

@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@kuboon
kuboon / Gemfile
Created November 20, 2015 06:30
acts_as_taggable_on + simple_form + select2
gem 'acts-as-taggable-on'
gem 'simple_form'
gem 'select2-rails'
@mark-d-holmberg
mark-d-holmberg / scraper-copy.sh
Created September 11, 2014 20:15
Copy files recursively
for i in `find . -name "feature-*" -type d`; do
nice=`echo $i | sed 's!^\.\/!\/!g'`;
pushd /Users/mark/Desktop/test$nice;
mv *.html ~/dev/stuff/app/views/feature/;
mv *.js ~/dev/stuff/app/assets/javascripts/;
mv css *.css ~/dev/stuff/app/assets/stylesheets/;
mv *.jpg *.png *.gif ~/dev/stuff/app/assets/images/;
popd;
done
#Sort the Ruby files in your project by number of has_many
ack " has_many " -c | awk -F ":" '{print $2,$1}' | grep -v "0" | sort -rn
#Sort the Ruby files in your project by LOC
find . -iname "*.rb" -type f -exec wc -l {} \; | sort -rn
#Count the lines of Ruby code in your app
find . -iname "*.rb" -type f -exec cat {} \; | wc -l
#multiple-datasets .league-name {
margin: 0 20px 5px 20px;
padding: 3px 0;
border-bottom: 1px solid #ccc;
}
@rrosiek
rrosiek / install_mysql.sh
Last active June 5, 2023 07:08
Vagrant provision script for php, Apache, MySQL, phpMyAdmin, Laravel, and javascript helpers. Tested with Ubuntu 16.04.
#! /usr/bin/env bash
###
#
# install_mysql.sh
#
# This script assumes your Vagrantfile has been configured to map the root of
# your application to /vagrant and that your web root is the "public" folder
# (Laravel standard). Standard and error output is sent to
# /vagrant/vm_build.log during provisioning.
@trigeorgis
trigeorgis / filter_through_command.py
Last active April 12, 2018 19:27 — forked from olifante/filter_through_command.py
Sublime Text 3: "Filter Through Command" plugin
#!/usr/bin/env python
# -*- coding: utf-8 -*-
## based on https://gist.github.com/1910413 updated for Sublime Text 3
import sublime
import sublime_plugin
import subprocess
class PromptRunExternalCommand(sublime_plugin.WindowCommand):
@tokenvolt
tokenvolt / simple_form_bootstrap3.rb
Last active November 2, 2023 11:55
Bootstrap 3 simple form initializer
inputs = %w[
CollectionSelectInput
DateTimeInput
FileInput
GroupedCollectionSelectInput
NumericInput
PasswordInput
RangeInput
StringInput
TextInput