Skip to content

Instantly share code, notes, and snippets.

View digerata's full-sized avatar

Mike Wille digerata

View GitHub Profile
@chadly
chadly / export-history.sh
Created August 28, 2019 22:30
Export commit history for specific date range for all repositories in a directory
for d in */ ; do
cd $d
git log --since 2015-03-01 --until 2016-06-30 --reverse --pretty=format:https://github.com/civicsource/${d}commit/%H,%an,%ad,\"%s\" --date=iso > ../${d::-1}.csv
cd ..
done
@estahn
estahn / _compass-retina-sprites.scss
Created October 5, 2012 00:32
Using Compass to generate normal and retina sprite maps at once
@mixin all-retina-sprites($map, $map2x) {
@media (min--moz-device-pixel-ratio: 1.5),
(-o-min-device-pixel-ratio: 3/2),
(-webkit-min-device-pixel-ratio: 1.5),
(min-device-pixel-ratio: 1.5),
(min-resolution: 1.5dppx) {
$base-class: sprite-map-name($map);
.#{$base-class}-all-retina-sprites {
function switchGrails() {
echo "Switching to groovy version: $1"
echo "Switching to grails version: $2"
sudo rm /usr/local/{groovy,grails}
sudo ln -s /usr/lib/groovy/$1 /usr/local/groovy
sudo ln -s /usr/lib/grails/$2 /usr/local/grails
echo "Done!"
ls -latr /usr/local/{groovy,grails}
}
@shinzui
shinzui / datasize.rake
Created February 14, 2010 07:40
Rake task to get database and table sizes.
# Run rake db:size to get a print of your database size in bytes.
# Run rake db:tables:size to get the sizes for individual tables
# Works for MySQL and PostgreSQL. Not tested elsewhere.
namespace :db do
desc 'Print data size for entire database'
task :size => :environment do
database_name = ActiveRecord::Base.connection.instance_variable_get("@config")[:database]
adapter = ActiveRecord::Base.connection.adapter_name.downcase
@gruber
gruber / Liberal Regex Pattern for All URLs
Last active November 4, 2024 20:04
Liberal, Accurate Regex Pattern for Matching All URLs
The regex patterns in this gist are intended to match any URLs,
including "mailto:[email protected]", "x-whatever://foo", etc. For a
pattern that attempts only to match web URLs (http, https), see:
https://gist.github.com/gruber/8891611
# Single-line version of pattern:
(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))