Skip to content

Instantly share code, notes, and snippets.

@dergachev
dergachev / GIF-Screencast-OSX.md
Last active April 1, 2025 01:48
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@marcedwards
marcedwards / high-dpi-media.css
Last active March 2, 2025 20:24
A CSS media query that captures almost all high DPI aware devices.
/* ---------------------------------------------------------- */
/* */
/* A media query that captures: */
/* */
/* - Retina iOS devices */
/* - Retina Macs running Safari */
/* - High DPI Windows PCs running IE 8 and above */
/* - Low DPI Windows PCs running IE, zoomed in */
/* - Low DPI Windows PCs and Macs running Firefox, zoomed in */
/* - Android hdpi devices and above */
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
@henrik
henrik / example.rb
Created January 26, 2012 10:23
Simple memoize method for Ruby now that ActiveSupport::Memoizable is deprecated. Memoizes per argument set, handles falsy values.
def my_method(foo, bar)
memoize(:my_method, foo, bar) do
foo * bar
end
end
@fairchild
fairchild / Gemfile
Created December 7, 2011 09:58
An example sinatra omniauth client app
source :rubygems
gem 'sinatra'
gem 'json'
gem 'omniauth'
gem 'omniauth-oauth2'
gem 'omniauth-github'
# gem 'omniauth-att', :path => File.expand_path("./../../omniauth-att", __FILE__)
gem 'thin'
@h3h
h3h / .gitconfig
Created June 8, 2011 17:54
My global .gitconfig
[user]
name = Brad Fults
email = [email protected]
[alias]
amend = commit --amend
co = checkout
st = status
cp = cherry-pick
# edit config (global, local)
@hone
hone / newrelic.yml
Created June 1, 2011 19:15
New Relic config for Cedar
---
<%= ENV["RAILS_ENV"] %>:
error_collector:
capture_source: true
enabled: true
ignore_errors: ActionController::RoutingError
apdex_t: 0.5
ssl: false
monitor_mode: true
license_key: <%= ENV["NEW_RELIC_LICENSE_KEY"] %>
@nathos
nathos / fancy-hover-mixin.sass
Last active September 25, 2015 17:47
Compass fancy-hover - snazzy-looking image replacement hovers with an animated opacity ramp. Now using Compass sprites so you don't have to do the dirty work! See the demo at http://nathos.github.com/fancy-hovers/
@mixin fancy-hover($sprite_dir, $off_state, $hover_state, $speed: 0.3s)
$sprites: sprite-map("#{$sprite_dir}/*.png")
$width: image-width(sprite_file($sprites, $off_state))
$height: image-height(sprite_file($sprites, $off_state))
@include hide-text
width: $width
height: $height
background: sprite($sprites, $off_state) no-repeat
display: block
position: relative
@mralex
mralex / sinatra-memcacher.rb
Created May 5, 2011 05:41
Simple memcached helper for Sinatra.
require 'sinatra/base'
require 'memcached'
module Sinatra
module Memcacher
module Helpers
def cache(key, &block)
return block.call unless options.memcacher_enabled
begin
@mrflip
mrflip / fun_with_blocks.rb
Created April 27, 2011 01:15
Fun with blocks -- a couple things you might be glad to find out Ruby can do
#
# When you're using inject with a hash or somesuch, you can subgroup the source's elements:
#
# v--- the parens part here
{ 1 => 2, 3 => 4, :your => :mom }.inject({}) do |h, (k,v)|
h[k] = v**2 if v.is_a?(Numeric)
h
end
# => {1=>4, 3=>16}