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
import { NotFoundError } from './errors'; | |
export default class QueryResult { | |
constructor(p = Promise.resolve()) { | |
this.promise = p; | |
} | |
null() { | |
return new this.constructor((async () => { | |
try { |
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
import { useState } from 'react'; | |
import api from '../api'; | |
function useApi() { | |
const requests = {}; | |
const proxy = new Proxy({}, { | |
get: (target, prop) => { | |
if (Object.prototype.hasOwnProperty.call(target, prop)) return target[prop]; | |
return async () => { |
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
contract SimpleStorage { | |
uint storedData; | |
function SimpleStorage() { | |
storedData = 10; | |
} | |
function subtract() returns (uint retVal) { | |
storedData -= 1; | |
return storedData; |
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
FOO=foo |
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 | |
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
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
$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
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 |
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" |
NewerOlder