Skip to content

Instantly share code, notes, and snippets.

Avatar

Julian Martinez julianeon

View GitHub Profile
@julianeon
julianeon / react-form.js
Created Jul 9, 2020
React form using API Gateway Endpoint
View react-form.js
import React, { useState } from 'react'
import axios from 'axios';
const App = () => {
const [values, setValues] = useState({name: '', message: '', email: ''})
const [sent, setSent] = useState(false);
const handleChange = e => {
const {name, value} = e.target
setValues({...values, [name]: value})
}
@julianeon
julianeon / chat.postMessage.js
Created Jun 16, 2020
chat.postMessage method working script using JavaScript
View chat.postMessage.js
const request = require('request');
let token="xoxo-xoxo";
let channelid="C00LR00M";
var url = "https://slack.com/api/chat.postMessage";
var auth_token = token; //Your Bot's auth token
var headers = {
"Authorization": "Bearer " + auth_token,
"Content-Type" : "application/json"
}
View javascript-get-request-rows.html
<!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>
.box {
View get-request.html
<!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 {
View javascript-get-request-example.svelte
<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 Oct 10, 2017
Go aka golang basic auth example of a GET request, including headers, using the Zendesk API and fetching the body.
View basic_auth.go
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 Jul 4, 2015
Slack bot example, adapted from my working version.
View slack_bot.py
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 Jun 11, 2015
The file referenced in the Node.js account subscription script.
View rates.yml
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 Jun 11, 2015
A Node.js script that follows the transaction amounts, converted to USD, for a given account (here customized for Bitstamp).
View websocket_subscribe_account_txn.js
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
To subscribe to Bitstamp's activity.
View subscribe_bitstamp.js
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]
};
You can’t perform that action at this time.