Skip to content

Instantly share code, notes, and snippets.

@fat
fat / gist:3744369
Created September 18, 2012 17:10
all you probably really need
/*! normalize-all-you-really-need-tho.css v1.0.0 | MIT License */
html {
font-family: sans-serif; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
-ms-text-size-adjust: 100%; /* 2 */
}
body {
margin: 0;
@Tanner
Tanner / extensionize.sh
Created September 18, 2012 02:12
Creates a zip file without .git, .gitignore, or .DS_Store
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: ${0} directory"
exit 1
fi
if [ -d ${1} ]; then
DIR_NAME=$(basename ${1})
@dtchepak
dtchepak / randomString.hs
Created September 1, 2012 13:15
random strings (w/out quickcheck)
randomChar :: (RandomGen g) => State g Char
randomChar = state $ randomR ('a','z')
randomStringWithLength :: (RandomGen g) => Int -> State g String
randomStringWithLength i = replicateM i randomChar
randomString :: (RandomGen g) => State g String
randomString = state $ \g ->
let (charsToGen, g') = randomR (1,10) g
in runState (randomStringWithLength charsToGen) g'
@denitram
denitram / find and xargs
Last active August 28, 2016 22:46
find & xargs
# Find tutorial;
# http://www.grymoire.com/Unix/Find.html
# find files modified less than 5 days ago
$ find . -type f -mtime -5 -print | xargs ls -l
# find files (with spaces in name) modified less than 5 days ago
$ find . -type f -mtime -5 -print0 | xargs -0 ls -l
# find & remove directories older than 200 days
@emctoo
emctoo / random_int.hs
Created June 1, 2012 13:28
generate random int
module Main where
import qualified Random
main :: IO ()
main = do
a <- randInt 0 100
putStrLn $ show a
-- generate random number between [lo, hi]
import java.awt.Color;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import javax.imageio.ImageIO;
import org.runedream.api.methods.Environment;
import org.runedream.api.methods.Game;
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@jrochkind
jrochkind / gist:2161449
Created March 22, 2012 18:40
A Capistrano Rails Guide

A Capistrano Rails Guide

by Jonathan Rochkind, http://bibwild.wordpress.com

why cap?

Capistrano automates pushing out a new version of your application to a deployment location.

I've been writing and deploying Rails apps for a while, but I avoided using Capistrano until recently. I've got a pretty simple one-host deployment, and even though everyone said Capistrano was great, every time I tried to get started I just got snowed under not being able to figure out exactly what I wanted to do, and figured I wasn't having that much trouble doing it "manually".

@henrik
henrik / ocr.markdown
Created March 3, 2012 17:07
OCR on OS X with tesseract

Install ImageMagick for image conversion:

brew install imagemagick

Install tesseract for OCR:

brew install tesseract --all-languages

Or install without --all-languages and install them manually as needed.

@webmat
webmat / dashboards.rb
Created February 22, 2012 20:46
First draft of an active_admin-based view for Delayed::Job
ActiveAdmin::Dashboards.build do
# Add this section in your dashboard...
section "Background Jobs" do
now = Time.now.getgm
ul do
li do
jobs = Delayed::Job.where('failed_at is not null').count(:id)
link_to "#{jobs} failing jobs", admin_jobs_path(q: {failed_at_is_not_null: true}), style: 'color: red'
end