Skip to content

Instantly share code, notes, and snippets.

View alg's full-sized avatar

Aleksey Gureiev alg

View GitHub Profile
@alg
alg / app.js
Last active December 11, 2015 13:48
VideoRendering.render({
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,
var w = Ti.UI.createWindow({ backgroundColor: 'red' });
var sv = Ti.UI.createScrollView({
width: '100%',
height: '100%' });
w.add(sv);
var wr = Ti.UI.createView({
top: 10,
left: 10,
@alg
alg / multi-dispatch.rb
Created September 30, 2013 05:07
Ruby Multi-dispatch
module Kernel
MDEF_DEFINED = {}
def mdef(name, *types, &block)
sig = gen_sig(name, types)
MDEF_DEFINED[name] = (MDEF_DEFINED[name] || []) + [ sig ]
Kernel.send(:define_method, sig, &block)
end
def gen_sig(name, types)
config.treat_symbols_as_metadata_keys_with_true_values = true
config.filter_run focus: true
config.run_all_when_everything_filtered = true
%h2 Users
%table
%tr
%th Name
%th Email
%th Role
- User.all.each do |u|
%tr
%td= u.name
%td= u.email
@alg
alg / aliases
Created October 19, 2013 07:39
alias g="git status"
function gg {
git commit -v -a -m "$*"
}
alias gco='git checkout'
alias gbr='git branch'
alias ga='git add'

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
@alg
alg / remove_db_dump.rake
Created April 30, 2014 18:06
Remove db:structure:dump
# Place it in lib/tasks/
env = ENV['RACK_ENV'] || ENV['RAILS_ENV']
if env == 'production' || env == 'staging'
Rake::TaskManager.class_eval do
def remove_task(task_name)
@tasks.delete(task_name.to_s)
end
end
@alg
alg / a.rb
Last active August 29, 2015 14:10
module M
def m
puts "module"
end
end
class A
def m
puts "class"
end
- request:
method: post
uri: https://spidev.isi.deterlab.net:52323/axis2/services/Experiments.ExperimentsHttpsSoap11Endpoint/
body:
encoding: UTF-8
string: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://api.testbed.deterlab.net/xsd"
xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><tns:addExperimentAspects><tns:eid>Alfa-Romeo:ExperimentOne</tns:eid><tns:aspects><tns:type>layout</tns:type><tns:data>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiID8+CjxleHBlcmltZW50PgogPHZlcnNpb24+MS4wPC92ZXJzaW9uPgogPHN1YnN0cmF0ZXM+CiAgPG5hbWU+bGluazI8L25hbWU+CiAgPGNhcGFjaXR5PgogICA8cmF0ZT4xMDAwMDAuMDAwMDAwPC9yYXRlPgogICA8a2luZD5tYXg8L2tpbmQ+CiAgPC9jYXBhY2l0eT4KIDwvc3Vic3RyYXRlcz4KIDxzdWJzdHJhdGVzPgogIDxuYW1lPmxpbmswPC9uYW1lPgogIDxjYXBhY2l0eT4KICAgPHJhdGU+MTAwMDAwLjAwMDAwMDwvcmF0ZT4KICAgPGtpbmQ+bWF4PC9raW5kPgogIDwvY2FwYWNpdHk+CiA8L3N1YnN0cmF0ZXM+CiA8c3Vi