Skip to content

Instantly share code, notes, and snippets.

View cbetta's full-sized avatar
👨‍💻
Pouring some Gr4vy

Cristiano Betta cbetta

👨‍💻
Pouring some Gr4vy
View GitHub Profile
@cbetta
cbetta / week2.js
Created November 4, 2018 14:11
week2.js
let i = 0
console.log(i)
i += 1
console.log(i)
i++
console.log(i)
const j = 0;
@cbetta
cbetta / date.ejs
Last active November 4, 2018 14:21
Week 2 - Packages and a little simple server
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<%= new Date().toLocaleString() %>
@cbetta
cbetta / week2-fix.sh
Created November 4, 2018 13:14
Week 2 - Fix global package installs
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
code ~
# Add this line to .profile, .zshrc, .bashrc or .bash_profile
# export PATH=~/.npm-global/bin:$PATH
{
"swagger": "2.0",
"info": {
"version": "v2.2",
"title": "Open Data API",
"description": "Latest Swagger specification for OpenData ATM Locator"
},
"host": "developer.openbanking.org.uk",
"basePath": "/open-banking/v2.2",
"schemes": [
public String reverse(String input) {
if (input.length() == 1) return input;
String lastChar = input.substring(input.length()-1);
String rest = input.substring(0, input.length() - 1);
return lastChar + reverse(rest);
}
public static String reverse(String input) {
String output = "";
while(input.length() > 0) {
output += input.substring(input.length()-1);
input = input.substring(0, input.length() - 1);
}
return output;
}
@cbetta
cbetta / alias.sh
Last active August 29, 2015 14:26
Get the latest version of a gem
alias latest='function _latest(){ curl -s "https://rubygems.org/api/v1/versions/$1/latest.json" | cut -d"\"" -f 4 };_latest'
@cbetta
cbetta / controller.rb
Last active August 29, 2015 14:26
Example
...
def pay
Volt::Braintree.get_nonce.then do |nonce|
"Send to server to process"
end.fail do
"Handle failure"
end
end
def index_ready
client_token = "eyJ2ZXJzaW9uIjoyLCJhdXRob3JpemF0aW9uRmluZ2VycHJpbnQiOiI0NmE3NzFlMWNiYTVlODhhNDY3YWJjMTExYWJjOTU3NGU5MzE5NWMwMjM3NGQ1ZWQ5MWNjYWMyNzU2NTY3MTgxfGNyZWF0ZWRfYXQ9MjAxNS0wOC0wM1QxMzowNjo1OC45NTk4Njc2NDYrMDAwMFx1MDAyNm1lcmNoYW50X2lkPWRjcHNweTJicndkanIzcW5cdTAwMjZwdWJsaWNfa2V5PTl3d3J6cWszdnIzdDRuYzgiLCJjb25maWdVcmwiOiJodHRwczovL2FwaS5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tOjQ0My9tZXJjaGFudHMvZGNwc3B5MmJyd2RqcjNxbi9jbGllbnRfYXBpL3YxL2NvbmZpZ3VyYXRpb24iLCJjaGFsbGVuZ2VzIjpbXSwiZW52aXJvbm1lbnQiOiJzYW5kYm94IiwiY2xpZW50QXBpVXJsIjoiaHR0cHM6Ly9hcGkuc2FuZGJveC5icmFpbnRyZWVnYXRld2F5LmNvbTo0NDMvbWVyY2hhbnRzL2RjcHNweTJicndkanIzcW4vY2xpZW50X2FwaSIsImFzc2V0c1VybCI6Imh0dHBzOi8vYXNzZXRzLmJyYWludHJlZWdhdGV3YXkuY29tIiwiYXV0aFVybCI6Imh0dHBzOi8vYXV0aC52ZW5tby5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tIiwiYW5hbHl0aWNzIjp7InVybCI6Imh0dHBzOi8vY2xpZW50LWFuYWx5dGljcy5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tIn0sInRocmVlRFNlY3VyZUVuYWJsZWQiOnRydWUsInRocmVlRFNlY3VyZSI6eyJsb29rdXBVcmwiOiJodHRwczovL2FwaS5zYW5kYm94Lm
@cbetta
cbetta / Braintree Hosted Fields - Card validation.markdown
Created July 6, 2015 15:29
Braintree Hosted Fields - Card validation

Braintree Hosted Fields - Card validation

In this demo I tried to recreate the Braintree v.zero dropin experience of automatically detecting the credit card validity using the Hosted Field SDK.

A Pen by Cristiano Betta on CodePen.

License.