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 random | |
import csv | |
from datetime import timedelta | |
def load_circles(filename): | |
with open(filename, 'r') as csvfile: | |
reader = csv.reader(csvfile) | |
rows = list(reader)[1:] | |
for row in rows: | |
c = Circle.objects.create( |
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
#region Help: Introduction to the script task | |
/* The Script Task allows you to perform virtually any operation that can be accomplished in | |
* a .Net application within the context of an Integration Services control flow. | |
* | |
* Expand the other regions which have "Help" prefixes for examples of specific ways to use | |
* Integration Services features within this script task. */ | |
#endregion | |
#region Namespaces |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>Coinbase Demo</title> | |
</head> | |
<body> | |
<button id="btn">Comprar cn Criptomonedas</button> |
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
exports.webhookHandler = functions.https.onRequest(async (req, res) => { | |
const rawBody = req.rawBody; | |
const signature = req.headers['x-cc-webhook-signature']; | |
const webhookSecret = 'your webhook'; | |
try { | |
const event = Webhook.verifyEventBody(rawBody, signature, webhookSecret); | |
if (event.type === 'charge:pending') { | |
// TODO |
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
exports.createCharge = functions.https.onRequest((req, res) => { | |
cors(req, res, async () => { | |
// TODO get real product data from database | |
const chargeData = { | |
name: 'Widget', | |
description: 'Usando una pasarela de prueba', | |
local_price: { | |
amount: 9.99, | |
currency: 'USD', |
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
const functions = require('firebase-functions'); | |
const cors = require('cors')({ origin: '*' }); | |
const { Client, Webhook, resources } = require('coinbase-commerce-node'); | |
const coinbaseSecret = 'your-api-key'; | |
const signingSecret = 'your-webhook-secret'; | |
Client.init(coinbaseSecret); | |
const { Charge } = resources; |
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
Stream.fromIterable([1, 2, 3]); | |
Stream.value(10); | |
Stream.empty(); | |
Stream.error(Exception('ups! algo salio mal')); | |
Stream.fromFuture(Future.delayed(Duration(seconds: 1), () => 42)); | |
Stream.periodic(Duration(seconds: 1), (index) => index); |
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
Future<void> printWeather() async { | |
try { | |
final api = WeatherApiClient(); | |
final weather = await api.getWeather('London'); | |
print(weather); | |
} on SocketException catch (_) { | |
print('No se pudieron recuperar los datos. Comprueba tu conexión'); | |
} on WeatherApiException catch (e) { | |
print(e.message); | |
} catch (e, st) { |
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
const restaurant = { | |
'name' : 'Pizza Mario', | |
'cuisine': 'Italian', | |
if (addRatings) ...{ | |
'avgRating': 4.3, | |
'numRatings': 5, | |
} | |
}; |
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
int square(int value) { | |
// solo un simple ejemplo | |
// podría ser una función compleja con mucho código | |
return value * value; | |
} | |
// Dada una lista de valores, podemos mapearlos para obtener los cuadrados: | |
const values = [1, 2, 3]; | |
values.map(square).toList(); |
NewerOlder