Skip to content

Instantly share code, notes, and snippets.

View glebm's full-sized avatar

Gleb Mazovetskiy glebm

View GitHub Profile
@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".

@algal
algal / nginx-cors.conf
Created April 29, 2013 10:52
nginx configuration for CORS (Cross-Origin Resource Sharing), with an origin whitelist, and HTTP Basic Access authentication allowed
#
# A CORS (Cross-Origin Resouce Sharing) config for nginx
#
# == Purpose
#
# This nginx configuration enables CORS requests in the following way:
# - enables CORS just for origins on a whitelist specified by a regular expression
# - CORS preflight request (OPTIONS) are responded immediately
# - Access-Control-Allow-Credentials=true for GET and POST requests
// Alternative JavaScript Syntax
Person = :(name, address) { @name!, @address! }
Person::inspect = :{ <: "{@name} lives at {@address}" }
tj := Person('TJ', '314 Bessborough ave')
bob := Person('Bob', 'Some place')
[tj, bob].each(:(person){ print(person.inspect()) })
@zumbojo
zumbojo / bijective.rb
Created July 9, 2011 22:09
Simple bijective function (base(n) encode/decode)
# Simple bijective function
# Basically encodes any integer into a base(n) string,
# where n is ALPHABET.length.
# Based on pseudocode from http://stackoverflow.com/questions/742013/how-to-code-a-url-shortener/742047#742047
ALPHABET =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split(//)
# make your own alphabet using:
# (('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a).shuffle.join
@ymjing
ymjing / Monaco for Powerline.md
Last active March 24, 2022 14:34
Powerline-patched Monaco for Windows and OSX

Powerline-patched Monaco for Windows and OSX

This font is manually patched with Fontforge. It includes the glyphs from DejaVu Sans Mono for Powerline.

I recommend DirectWrite-patched VIM builds. I'm using KaoriYa's build (http://www.kaoriya.net/software/vim/)

Usage

Add the following lines to your .vimrc/_vimrc:

@joshkurz
joshkurz / app.js
Created August 9, 2012 03:21
AngularJs-twitterBootstrap-wysiHtml5
var demoApp = angular.module('demoApp', ['ngResource'], function($locationProvider) {
$locationProvider.hashPrefix('');
});
function MainCtrl($scope, Serv) {
$scope.selectedItem = {
value: 0,
label: ''
};
$scope.Wrapper = Serv;
@function up-to($list, $index) {
$l: ();
@each $e in $list {
@if length($l) < $index {
$l: append($l, $e, list-separator($list));
}
}
@return $l;
}
@anna-is-cute
anna-is-cute / travis_cache.md
Last active April 21, 2020 21:40
Rust and Travis CI cache

Rust and Travis CI cache

Using Travis CI's cache is very useful and helps cut Rust job times way, way down. However, the way that the default caching for Cargo is set up means it will quickly bloat.

Travis currently checks ~/.cargo and target/ for any changes from the current cache after a build. There will always be changes in target/ if the source has changed, which it usually does when a Travis build runs. This means new incremental object files, fingerprints, and build script compilation files are being added to the cache every build.

@glebm
glebm / i18n_status.html.slim
Created June 22, 2014 18:06
Missing and unused translations report (i18n-tasks v0.5.0+)
h1 Missing and unused translations
- if @missing.present?
.panel.panel-default
.panel-heading: h3.panel-title #{@missing.leaves.count} missing keys
table.table.table-striped.table-condensed
thead: tr
th.text-right Locale
th Key
th Value
anonymous
anonymous / Cargo.toml
Created November 12, 2015 01:18
[package]
name = "fst-int"
version = "0.1.0"
authors = ["Andrew Gallant <jamslam@gmail.com>"]
[dependencies]
byteorder = "0.4"
fst = "0.1"