This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
watch('cookbooks/.*/.*') do |file| | |
puts file | |
cookbook = file[0].split("/")[1] | |
system("knife cookbook upload #{cookbook}") | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lock the database | |
response = session.command(fsync: 1, lock: true) | |
# unlock | |
response = session["$cmd.sys.unlock"].find({}).first | |
OlderNewer