Skip to content

Instantly share code, notes, and snippets.

@sadjow
sadjow / .vimrc
Created August 26, 2014 20:29
Make vim on gnome terminal use 256 colors better
" Add this to the end of vimrc
if $COLORTERM == 'gnome-terminal'
set t_Co=256
endif
@sadjow
sadjow / designer.html
Last active August 29, 2015 14:06
designer
<link rel="import" href="../google-map/google-map-directions.html">
<link rel="import" href="../google-map/google-map.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
@sadjow
sadjow / makesure.example.coffee
Last active August 29, 2015 14:08
A simple example of makesure using CoffeeScript
validateUser = makesure ->
@permit "name email" # optional
@attrs("name email").isNot('empty').orSay "can't be empty"
userInput =
name: ""
description: "My description"
admin: true
# Generates SQL from migrations
#
# Usage:
# rake db:[migrate,rollback]:with_sql
#
# The previous rake task will run migrations and create a file in `db/migrate_sql`
# Depending on migrate or rollback a file will be created with the respective
# sufix.
#
# Drawbacks:
@sadjow
sadjow / .bashrc
Created July 13, 2015 17:00
Make tmux works with vim on ubuntu
export TERM="screen-256color"
alias tmux="TERM=screen-256color tmux -2"
@sadjow
sadjow / paperclip_support.rb
Last active August 29, 2015 14:26
Avoid paperclip to process the images in tests.
# Avoid paperclip to process the images in tests.
module Paperclip
class << self
alias_method :old_run, :run
def run cmd, params = "", expected_outcodes = 0
case cmd
when "identify"
return old_run(cmd, params, expected_outcodes)
We couldn’t find that file to show.
derby = require 'derby'
{get, view, ready} = derby.createApp module
derby.use(require '../../ui')
FeedParser = require('feedparser')
parser = new FeedParser()
## ROUTES ##
@sadjow
sadjow / rmagick.sh
Created January 25, 2013 17:50 — forked from zoras/rmagick.sh
sudo apt-get install libdjvulibre-dev libjpeg-dev libtiff-dev libwmf-dev libmagickcore-dev libmagickwand-dev libmagick++-dev rvm
sudo gem install rmagick
ok!
Fetching: rmagick-2.13.1.gem (100%) Building native extensions. This could take a while ... Successfully installed rmagick-2.13.1 1 gem installed
require 'RMagick' #=> true
@sadjow
sadjow / truncate.haml
Last active December 12, 2015 04:38
Truncate a text with HTML/HAML
= raw truncate(strip_tags(item.description), :length => 90, :omission => '... ')