Skip to content

Instantly share code, notes, and snippets.

View julianeon's full-sized avatar

Julian Martinez julianeon

View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>JavaScript GET Request</title>
<style>
.featured {
<svelte:head>
<title>JavaScript GET Request: An Example</title>
</svelte:head>
<script>
import fetch from 'isomorphic-unfetch'
import Coding from './_coding.svelte';
const url='https://api.coindesk.com/v1/bpi/currentprice.json'
const fetchText = (async () => {
const response = await fetch(url);
@julianeon
julianeon / basic_auth.go
Created October 10, 2017 18:16
Go aka golang basic auth example of a GET request, including headers, using the Zendesk API and fetching the body.
package main
import "os"
import "fmt"
import "net/http"
import "io/ioutil"
func main() {
url := "https://fake.zendesk.com/api/v2/satisfaction_ratings?score=good_with_comment"
username := "fake@mail.com/token"
@julianeon
julianeon / slack_bot.py
Created July 4, 2015 22:23
Slack bot example, adapted from my working version.
import time, json, yaml, re, os, myfunc
from slackclient import SlackClient
with open('slack.yaml', 'r') as f:
doc = yaml.load(f)
user_id=doc["user_id"]
user_name=doc["user_name"]
user_address=doc["user_address"]
print user_id
@julianeon
julianeon / rates.yml
Created June 11, 2015 22:13
The file referenced in the Node.js account subscription script.
BTC: "229.30"
CNY: "0.16"
BRL: "0.32"
MXN: "0.065"
JPY: "0.0081"
XRP: "0.0079"
EUR: "1.13"
KRW: "0.00090"
BIT: "0.0025"
@julianeon
julianeon / websocket_subscribe_account_txn.js
Created June 11, 2015 22:09
A Node.js script that follows the transaction amounts, converted to USD, for a given account (here customized for Bitstamp).
var WebSocket = require('ws');
var moment= require('moment');
var yaml = require('js-yaml');
var fs = require('fs');
try {
var doc = yaml.safeLoad(fs.readFileSync('rates.yml', 'utf8'));
yen_value=doc["EUR"];
console.log(yen_value);
} catch (e) {
@julianeon
julianeon / subscribe_bitstamp.js
Created May 12, 2015 01:07
To subscribe to Bitstamp's activity.
var WebSocket = require('ws');
var moment= require('moment');
var ws = new WebSocket('wss://s1.ripple.com:443/');
var bitstamp = "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B";
var account = bitstamp;
var info_subscribe={
command: "subscribe",
accounts: [bitstamp]
};
@julianeon
julianeon / xrp_price.rb
Created March 25, 2015 18:09
Get the current price in USD from SnapSwap (essentially, how many dollars it costs to buy 1 XRP).
#!/usr/bin/env ruby
require 'json'
require 'yaml'
ripple=YAML.load_file("ripple.yml")
server=ripple["server"]["api"]
snapswap=ripple["address"]["snapswap"]
bitstamp=ripple["address"]["bitstamp"]
info="/v1/accounts/#{snapswap}/payments/paths/#{snapswap}/1.0+XRP"
endpoint="#{server}#{info}"
@julianeon
julianeon / pathfind.js
Created March 5, 2015 01:56
Ripple lib pathfinding example.
var ripple = require('ripple-lib');
var remote = new ripple.Remote({
servers: [ 'wss://s1.ripple.com:443' ]
});
var pathFind = function(responseCallback) {
try {
var currency = 'USD';
var amount = ripple.Amount.from_human('0.001 USD')
@julianeon
julianeon / parse_tx.js
Last active August 29, 2015 14:16
Attempt to parse transaction.
var tx_parse=require('ripple-lib-transactionparser');
var json= {
success: true,
transaction: {
TransactionType: "Payment",
Flags: 0,
Sequence: 99,
DestinationTag: 88298231,
Amount: {