Skip to content

Instantly share code, notes, and snippets.

View ricalamino's full-sized avatar
♦️
Piece of peace

Ricardo Alamino ricalamino

♦️
Piece of peace
View GitHub Profile
@ricalamino
ricalamino / notion2blog.js
Created July 22, 2020 12:36 — forked from mayneyao/notion2blog.js
Notion.so > Personal Blog | custom domain + disqus comment
const MY_DOMAIN = "agodrich.com"
const START_PAGE = "https://www.notion.so/gatsby-starter-notion-2c5e3d685aa341088d4cd8daca52fcc2"
const DISQUS_SHORTNAME = "agodrich"
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
@ricalamino
ricalamino / fetch_kindle.js
Last active April 11, 2020 13:37 — forked from yangchenyun/fetch_kindle.js
Get back my books from Kindle
/*
* @fileoverview Program to free the content in kindle books as plain HTML.
*
* This is largely based on reverse engineering kindle cloud app
* (https://read.amazon.com) to read book data from webSQL.
*
* Access to kindle library is required to download this book.
*/
// The Kindle Compression Module copied from http://read.amazon.com application
@ricalamino
ricalamino / kaprekar.js
Last active August 28, 2019 17:13 — forked from slawrence/kaprekar.js
kaprekar.js
var num = "174";
kaprekar(num);
function kaprekar(num){
s1 = parseInt(num.split("").sort().join(""));
s2 = parseInt(num.split("").sort(function(a,b){return b-a}).join(""));
n = (s1 > s2) ? s1 -s2 : s2 - s1;
(s1 > s2) ? console.log(s1 + " - " + s2 + " = " + n) : console.log(s2 + " - " + s1 + " = " + " = " + n);
if(n === parseInt(num)){
@ricalamino
ricalamino / megasena.py
Created May 29, 2019 15:10 — forked from berlotto/megasena.py
Numeros da MegaSena
# -*- encoding: utf-8 -*-
#
# Python Script - Numeros da Megasena
# Faz o download do arquivo da Caixa Economica Federal, com todos os resultados
# da Mega já obtidos. Faz uma contagem simples e mostras, em ordem decrescente,
# a quantidade de vezes que os nros já foram sorteados.
#
# Author: Sergio Berlotto <sergio.berlotto@gmail.com>
# Author website: http://berlotto.github.io
# Licence: GPLv3
@ricalamino
ricalamino / .htaccess
Last active May 15, 2019 12:51 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@ricalamino
ricalamino / AjaxContactForm.md
Last active October 5, 2018 18:09 — forked from patotoma/AjaxContactForm.md
Simple Asynchronous Contact Form with jQuery and PHP

Simple Ajax Contact Form with jQuery and PHP

Files:

  • index.html
  • style.css
  • js.js
  • mailer.php

Use:

@ricalamino
ricalamino / sample.js
Last active August 6, 2018 14:48 — forked from manix/sample.js
Improved "fieldSorter" - usage( arrayOfObjects.sort(fieldSorter(['-price', 'orderId'])); )
function fieldSorterOptimized(fields) {
var dir = [], i, l = fields.length;
fields = fields.map(function(o, i) {
if (o[0] === "-") {
dir[i] = -1;
o = o.substring(1);
} else {
dir[i] = 1;
}
return o;