Skip to content

Instantly share code, notes, and snippets.

/**
* OUTPUT:
* NetConnection.Connect.Success
* Error opening URL 'http://video-origin.hola.com/cine/no-existe.flv'
* NetStream.Play.StreamNotFound
*/
import com.akamai.net.*;
import org.openvideoplayer.events.*;
var video:Video = new Video();
public class Post {
public static final int STATUS_DRAFT = 0;
public static final int STATUS_PENDING_REVIEW = 1;
public static final int STATUS_PUBLISHED = 2;
private int status = STATUS_DRAFT;
public String getStatus()
require 'rubygems'
# Set up gems listed in the Gemfile.
gemfile = File.expand_path('../../Gemfile', __FILE__)
begin
ENV['BUNDLE_GEMFILE'] = gemfile
require 'bundler'
Bundler.setup
rescue Bundler::GemNotFound => e
STDERR.puts e.message
# controllers/foo.rb
#
class FooController < ApplicationController
def index
render :text => Foo.value
end
end
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
"01";"Alegría-Dulantzi"
"01";"Amurrio"
"01";"Añana"
"01";"Aramaio"
"01";"Armiñón"
"01";"Arraia-Maeztu"
"01";"Arrazua-Ubarrundia"
"01";"Artziniega"
"01";"Asparrena"
"01";"Ayala/Aiara"
require 'uri'
require 'yajl/http_stream'
url = "http://search.twitter.com/search.json?q=real+madrid&geocode=40.427455,-3.67865,1mi"
out = Yajl::HttpStream.get(URI.parse(url))['results'].map {|t| t.values.map{|v| "'#{v}'"}.join(";")}.join("\n")
File.open("tweets.csv", "w") do |file|
file << out
end
$select = "b.pais AS pais , b.nombre_agente_ejecutor AS ong , c.descripcion_es AS Des_tipo, d.des_agrupacion_es AS agrupacion, d.descripcion_es AS Des_tema, e.des_mes_es, e.id_mes,f.desc_actividades_ag_es,SUM(a.num_activades) AS num_actividades, SUM(a.num_participantes) AS num_participantes";
$from = "agr_pi_actividades_mult_temas a, dim_organizacion_global b, dim_tipo_actividad_pi c, dim_tema_actividad d, dim_tiempo e, dim_actividades_agrupadas f";
$group_by = "b.pais, b.nombre_agente_ejecutor, c.descripcion_es, d.des_agrupacion_es, d.descripcion_es, e.des_mes_es,e.id_mes,f.desc_actividades_ag_es";
SELECT {$select}
FROM {$from}
WHERE
b.id_pais= ${pais}
AND -1 <> ${ong}
AND b.id_agente_ejecutor= ${ong}
watch('cookbooks/.*/.*') do |file|
puts file
cookbook = file[0].split("/")[1]
system("knife cookbook upload #{cookbook}")
end
@dagi3d
dagi3d / ebs_test.rb
Created April 10, 2013 17:49
ebs attaching
require 'right_aws'
ec2 = RightAws::Ec2.new(ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY'])
volume = ec2.create_volume(nil, 1, 'us-east-1c')
sleep 5
ec2.attach_volume(volume[:aws_id], 'i-3b7dc953', '/dev/sdh1')
@dagi3d
dagi3d / gist:5966926
Created July 10, 2013 14:46
lock and unlock database with moped
# lock the database
response = session.command(fsync: 1, lock: true)
# unlock
response = session["$cmd.sys.unlock"].find({}).first