Skip to content

Instantly share code, notes, and snippets.

Avatar

Dominik Weiss dasgib

View GitHub Profile
View images_helper.rb
module ImagesHelper
# Acts as a thin wrapper for image_tag and generates an srcset attribute for regular image tags
# for usage with responsive images polyfills like picturefill.js, supports asset pipeline path helpers.
#
# image_set_tag 'pic_1980.jpg', { 'pic_640.jpg' => '640w', 'pic_1024.jpg' => '1024w', 'pic_1980.jpg' => '1980w' }, sizes: '100vw', class: 'my-image'
#
# => <img src="/assets/ants_1980.jpg" srcset="/assets/pic_640.jpg 640w, /assets/pic_1024.jpg 1024w, /assets/pic_1980.jpg 1980w" sizes="100vw" class="my-image">
#
def image_set_tag(source, srcset = {}, options = {})
srcset = srcset.map { |src, size| "#{asset_path(src)} #{size}" }.join(', ')
View mdb2sql.sh
#!/bin/bash
# Convert a MDB file (Access) to SQL
# Needs mdbtools[http://mdbtools.sourceforge.net/]
# run 'aptitude install mdbtools' on Debian/Ubuntu
# Created by Álvaro Justen <https://github.com/turicas>
# License: GPLv2
mdb=$1
sql=$2
@dasgib
dasgib / todoist.userscript.js
Created Apr 30, 2014
Userscript for todoist.com (Non-Premium)
View todoist.userscript.js
window.onload = function() {
// add "overview" button
var filters_list = document.getElementById('top_filters');
var home_filter = document.createElement('li');
home_filter.setAttribute('class', 'filter current');
home_filter.innerHTML = '<img src="https://d3ptyyxy2at9ui.cloudfront.net/76084e29cb2cf72b320e888edc583dfb.gif" width="20" height="18" class="cmp_filter_inbox" style="background-position: -2px -649px">Overview';
home_filter.onclick = function() { document.location.href = 'https://todoist.com' }
@dasgib
dasgib / todoist.userstyle.css
Last active Aug 29, 2015
Userstyle for todoist.com (Non-Premium)
View todoist.userstyle.css
/* hide useless stuff */
#td_logo,
#notifications_counter,
#completed_items {
display: none !important;
}
#top_filters {
padding-top: 0 !important;
View keybase.md

Keybase proof

I hereby claim:

  • I am dasgib on github.
  • I am dasgib (https://keybase.io/dasgib) on keybase.
  • I have a public key whose fingerprint is 346D 4B2F D925 3F26 FE79 5A62 E476 C80C E0FC 2E65

To claim this, I am signing this object:

@dasgib
dasgib / gist:3782943
Created Sep 25, 2012
Copy all songs in a .m3u file exported via iTunes to a new directory
View gist:3782943
IFS=$'\n'; mkdir playlist; for FILE in `tr "\r" "\n" < playlist.m3u | grep -v "^#"`
do
SONG=`basename $FILE`
ALBUM=`basename ${FILE/$SONG//}`
ARTIST=`basename ${FILE/$ALBUM\/$SONG//}`
cp $FILE "./playlist/$ARTIST - $ALBUM - $SONG"
done
@dasgib
dasgib / compass-retina-sprites.scss
Created Jun 23, 2012 — forked from thulstrup/compass-retina-sprites.scss
Using Compass to generate normal and retina sprite maps
View compass-retina-sprites.scss
$sprites: sprite-map("sprites/*.png");
$sprites-retina: sprite-map("sprites-retina/*.png");
@mixin sprite-background($name) {
background-image: sprite-url($sprites);
background-position: sprite-position($sprites, $name);
background-repeat: no-repeat;
display: block;
height: image-height(sprite-file($sprites, $name));
width: image-width(sprite-file($sprites, $name));
@dasgib
dasgib / svg2png
Created Jun 23, 2012
Use Imagemagick to convert .SVG to .PNG
View svg2png
#!/bin/bash
if [ -z "$1" ] || [ -z "$3" ] || [ -z "$3" ]
then
echo "Syntax: svg2png <source.svg> <dest.png> <16x16> [<negate>]"
else
if [ -z "$4" ]
then
convert -background none -resize $3 -gravity center -extent $3 $1 $2
else
@dasgib
dasgib / .zshrc
Created Dec 20, 2011
pathed_cd for zsh - start new shell in last used directory
View .zshrc
pathed_cd () {
if [ x"$1" = x ]; then
cd
else
cd "$1"
fi
pwd > ~/.cdpath
}
View dasgib.zsh-theme
PROMPT='%{$fg[white]%} %{$fg[green]%}%2~ %{$fg[grey]%}$(git_prompt_info)%{$fg[yellow]%}→ %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX=""
ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}●%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_CLEAN=" "