Skip to content

Instantly share code, notes, and snippets.

@leandrodaher
leandrodaher / folder_structure.md
Created October 9, 2023 15:00 — forked from ayoubzulfiqar/folder_structure.md
The Folder Structure for Every Golang Project

Go - The Ultimate Folder Structure

Organizing your Go (Golang) project's folder structure can help improve code readability, maintainability, and scalability. While there is no one-size-fits-all structure, here's a common folder structure for a Go project:

project-root/
    ├── cmd/
    │   ├── your-app-name/
    │   │   ├── main.go         # Application entry point
    │   │   └── ...             # Other application-specific files

After a couple hesitating months to move to github pages, and from my hacked together static site generator, yesterday was my 4th attempt in getting started with github pages blogging, just because there where a few annoyances with the different variations I've tried.

Decided to go with Octopress, just for their nice logo. And for their Github pages oriented focus. That didn't pan out, but at least I learned a few things about their blogging process and setup, which I'm adapting for sculpin.

Sculpin for Github pages (Déjà vu)

@leandrodaher
leandrodaher / Stats.js
Created August 21, 2023 19:23 — forked from rygorous/Stats.js
Half-space tri rasterizers in JS
// stats.js r9 - http://github.com/mrdoob/stats.js
var Stats=function(){var h,a,r=0,s=0,i=Date.now(),u=i,t=i,l=0,n=1E3,o=0,e,j,f,b=[[16,16,48],[0,255,255]],m=0,p=1E3,q=0,d,k,g,c=[[16,48,16],[0,255,0]];h=document.createElement("div");h.style.cursor="pointer";h.style.width="80px";h.style.opacity="0.9";h.style.zIndex="10001";h.addEventListener("mousedown",function(a){a.preventDefault();r=(r+1)%2;0==r?(e.style.display="block",d.style.display="none"):(e.style.display="none",d.style.display="block")},!1);e=document.createElement("div");e.style.textAlign=
"left";e.style.lineHeight="1.2em";e.style.backgroundColor="rgb("+Math.floor(b[0][0]/2)+","+Math.floor(b[0][1]/2)+","+Math.floor(b[0][2]/2)+")";e.style.padding="0 0 3px 3px";h.appendChild(e);j=document.createElement("div");j.style.fontFamily="Helvetica, Arial, sans-serif";j.style.fontSize="9px";j.style.color="rgb("+b[1][0]+","+b[1][1]+","+b[1][2]+")";j.style.fontWeight="bold";j.innerHTML="FPS";e.appendChild(j);f=document.createElement("div");f.style.position="relati
@leandrodaher
leandrodaher / gist:fb5b5b20cb6c5abb7db0a79277eda74f
Created August 14, 2023 19:30 — forked from galaakk/gist:3679211
jQuery : Scroll to anchor
$(document).ready(function() {
// Click event for any anchor tag that's href starts with #
$('a[href^="#"]').click(function(event) {
// The id of the section we want to go to.
var id = $(this).attr("href");
// An offset to push the content down from the top.
var offset = 60;
@leandrodaher
leandrodaher / README.md
Created August 14, 2023 12:11 — forked from vinicius-stutz/README.md
Máscara p/ telefones com 8 ou 9 dígitos (jquery.mask.js)
@leandrodaher
leandrodaher / gist:456076f7ac844485b5552ec4a2071a63
Created July 25, 2023 14:16 — forked from entaroadun/gist:1653794
Recommendation and Ratings Public Data Sets For Machine Learning

Movies Recommendation:

Music Recommendation:

@leandrodaher
leandrodaher / cross-origin-local-storage.js
Created June 16, 2023 19:23 — forked from buren/cross-origin-local-storage.js
Cross origin local storage sharing example (using an iframe and postMessage)
const CrossOriginLocalStorage = function(currentWindow, iframe, allowedOrigins, onMessage) {
this.allowedOrigins = allowedOrigins;
let childWindow;
// some browser (don't remember which one) throw exception when you try to access
// contentWindow for the first time, it works when you do that second time
try {
childWindow = iframe.contentWindow;
} catch(e) {
childWindow = iframe.contentWindow;
@leandrodaher
leandrodaher / composing-software.md
Created June 5, 2023 14:44 — forked from rosario/composing-software.md
Eric Elliott's Composing Software Series
@leandrodaher
leandrodaher / olx.js
Created May 20, 2023 19:19 — forked from phpenterprise/olx.js
OLX Data Extractor (Scraping)
(Olx = {
release: '1.0.5 RC',
j: $,
path: window.location.href,
settings: {
debug: true,
url: window.location.href.replace(/\.(\w+)\/.*/, '.$1') + '/vi/{id}?rec=h',
filename: "olx.csv",
split: 100,
speed: 700,
@leandrodaher
leandrodaher / vimeo-downloader.js
Created May 18, 2023 15:05 — forked from mistic100/vimeo-downloader.js
Download video from Vimeo (chopped m4s files)
// 1. Open the browser developper console on the network tab
// 2. Start the video
// 3. In the dev tab, locate the load of the "master.json" file, copy its full URL
// 4. Run: node vimeo-downloader.js "<URL>"
// 5. Combine the m4v and m4a files with mkvmerge
const fs = require('fs');
const url = require('url');
const https = require('https');