Skip to content

Instantly share code, notes, and snippets.


Aleksey Gureiev alg

View GitHub Profile
View README.markdown

This is a very rough script to export your octopress files to Ghost. You will still need to check your data but it will give you a head start. Feel free to fork and optimize the script for your purpose.

The following should be considered:

  1. You need to execute the script in the source/_posts directory
  2. You need to manually copy all the images to /var/www/ghost/content/images
  3. Images with external URLs are not handled
  4. Blockquotes have their issues
  5. Lists are not exported correctly
View aliases
alias g="git status"
function gg {
git commit -v -a -m "$*"
alias gco='git checkout'
alias gbr='git branch'
alias ga='git add'
View front.html.haml
%h2 Users
%th Name
%th Email
%th Role
- User.all.each do |u|
View spec_helper.rb
config.treat_symbols_as_metadata_keys_with_true_values = true
config.filter_run focus: true
config.run_all_when_everything_filtered = true
alg / multi-dispatch.rb
Created Sep 30, 2013
Ruby Multi-dispatch
View multi-dispatch.rb
module Kernel
def mdef(name, *types, &block)
sig = gen_sig(name, types)
MDEF_DEFINED[name] = (MDEF_DEFINED[name] || []) + [ sig ]
Kernel.send(:define_method, sig, &block)
def gen_sig(name, types)
View app.js
var w = Ti.UI.createWindow({ backgroundColor: 'red' });
var sv = Ti.UI.createScrollView({
width: '100%',
height: '100%' });
var wr = Ti.UI.createView({
top: 10,
left: 10,
View app.js
video: [
fixtureFile("1.m4v"), // passing as TiFile
fixtureFile("2.m4v").getNativePath() // passing as URL (native path is presented as file://...)
titles: [
{ text: "AUG 6, 1945",
font: "HelveticaNeue-CondensedBlack",
fontSize: 32,
View fill_in_date.rb
# Fills the standard Rails 3-field date picker with the date.
# #name# is supposed to lead to one of these fields, either through a label or a CSS selector.
# Usage:
# fill_in_date "Date of birth", with: 30.years.ago
def fill_in_date(name, options)
date = options[:with]
within find_field(name).parent do
View communal.rb
# encoding: utf-8
def gas(name = "", acct = "")
url = ""
data = `curl -F "afam=#{name}" -F "peracc=#{acct}" "#{url}" 2>/dev/null`
def water(name = "", acct = "")
View gist:3952537
describe SomeController do
context "if user is not logged in" do
[ :show, :edit, :update ].each do |action|
specify do
get action
should redirect_to login_path
You can’t perform that action at this time.