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 / 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.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 / 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;
}
class A
def self.foo val
define_method "foo" do
val
end
end
end
def valid_login(token = '')
interactable = Interaction.where(interactable_type: 'Ticket', key: 'wristband', value: token)
ticket = Ticket.find(interactable(:interactable_id))
end
@cbetta
cbetta / update.rb
Last active December 12, 2015 04:28
apt-get update before puppet
stage { 'preinstall':
before => Stage['main']
}
class apt_get_update {
exec { 'apt-get -y update': }
}
class { 'apt_get_update':
stage => preinstall
require 'bloomfilter'
bf = BloomFilter.new({ 'bits' => 0xff, 'salts' => %w(z A) })
bf.add("foo")
bf.test("foo")
#=> true
bf.to_json