Skip to content

Instantly share code, notes, and snippets.

View franciscolourenco's full-sized avatar

Francisco Lourenço franciscolourenco

View GitHub Profile
#!/usr/bin/env ruby
require 'json'
def load_json(url) JSON.parse(`wget -q -O- #{url}`) end
class String
#extend: http://misc.flogisoft.com/bash/tip_colors_and_formatting
def black; "\e[30m#{self}\e[0m" end
def red; "\e[31m#{self}\e[0m" end
def green; "\e[32m#{self}\e[0m" end
@franciscolourenco
franciscolourenco / index.js
Created March 6, 2016 09:39
requirebin sketch
// require() some stuff from npm (like you were using browserify)
// and then hit Run Code to run it on the right
moment = require('moment');
var console = require('demo-console');
console.log(moment('2016-W32').format());
console.log(moment('2016-SU').format());
<style>*{margin:0;padding:0;box-sizing:border-box;}canvas{width:100%;height:100%}</style>
<canvas id='C'>
<script>
var c = C.getContext("2d"), R = Math.random;
C.width = window.innerWidth; C.height = window.innerHeight;
function dist(a,b,x,y){return Math.sqrt(Math.pow(a-x,2)+Math.pow(b-y,2))}
function generatePlanets(n){
var i, s = [50,100,150,200], m = s.slice(-1)[0];
@franciscolourenco
franciscolourenco / index.js
Created September 9, 2016 15:34
requirebin sketch
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
axios = require('axios')
axios.defaults.baseURL = "https://api.icndb.com";
// Response 1
axios.get('/jokes/random').then(response => document.getElementById('response1').innerText = response.data.value.joke)
var bubble = {
"date": Date(),
"title": document.title,
"url": window.location.toString(),
"domain": window.location.hostname,
"meta": [document.querySelector("meta[property='og:type']"), document.querySelector("meta[property='og:description']")]
};
var keyBubbleObj = {bubble.url: bubble};

Keybase proof

I hereby claim:

  • I am aristidesfl on github.
  • I am aristidesfl (https://keybase.io/aristidesfl) on keybase.
  • I have a public key ASDFLBvEDN4qPQiUMZ9_5AjwHZyCOWGYTEULPht7THSzCwo

To claim this, I am signing this object: