Skip to content

Instantly share code, notes, and snippets.

View yuigoto's full-sized avatar
😓
pretty much exhausted, missing some sleep

Fabio Goto yuigoto

😓
pretty much exhausted, missing some sleep
View GitHub Profile
@yuigoto
yuigoto / CodeIgniter_PDOSQLiteMySQL.php
Last active February 14, 2023 06:25
[PHP : CodeIgniter Config] How to setup PDO and SQLite for CodeIgniter (for SQLite and MySQL). This is the `database.php` file in `the application/config` folder #codeigniter
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$active_group = 'default';
$query_builder = TRUE;
// FOR SQLITE
$db['default'] = array(
'dsn' => 'sqlite:[path-to-database-file]',
'hostname' => 'localhost',
@yuigoto
yuigoto / estimando_pi_com_montecarlo.pde
Last active April 19, 2019 23:15
[Processing : Pi com Montecarlo] Minha versão para Processing (3.x) do algoritmo para estimar o valor de PI, do vídeo do canal Yarquen.
/**
* ESTIMANDO PI COM MONTECARLO
* ============================================================
*
* Baseado no vídeo e no sketch P5.js feitos pelo Guilherme Rey
* (Yarquen) em https://www.youtube.com/watch?v=VQvw3u-zSZg.
*
* Assista! É importante para entender bem o que acontece aqui!
*
* Apesar do P5.js ser uma versão do processing, pelo fato de
@yuigoto
yuigoto / .MONTECARLO.md
Last active June 10, 2023 17:21
Estimando o valor de PI usando Monte Carlo, em diferentes linguagens.

Estimando o valor de PI com Monte Carlo

Implementando MonteCarlo em diferentes linguagens, para aprendizado e testes.

@yuigoto
yuigoto / CreateEvent.gml
Last active April 19, 2019 23:28
[GameMaker : Gerenciando Surfaces] Exemplo de como gerenciar surfaces em GML
/// @description Inicializa parâmetros do objeto
// Inicializa a surface como noone
surface = noone;
// Prefiro ter a variável inicializada no create, por segurança,
// na hora de checar depois
@yuigoto
yuigoto / User.php
Created March 16, 2018 02:50 — forked from Ocramius/User.php
Doctrine 2 ManyToMany - the correct way
<?php
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity()
* @ORM\Table(name="user")
*/
class User
@yuigoto
yuigoto / cleanTrailingHtml.js
Last active April 19, 2019 23:14
[JavaScript : Metalsmith Paginator] : Metalsmith + Handlebars pagination #js
/**
* YX : HANDLEBARS : cleanTrailingHtml
* ----------------------------------------------------------------------
* Clears the trailing `index.html` from path strings.
*
* @author Fabio Y. Goto <lab@yuiti.com.br>
* @copyright 2018 Fabio Y. Goto
* @since 0.0.1
*
* @param {string} string
@yuigoto
yuigoto / .YOUTUBE.md
Last active June 10, 2023 17:17
[Lab : Extracting YouTube video IDs] Extracting YouTube video ID from URLs, short URLs, iframe embed or object embed codes, in multiple languages. Will keep adding as I learn and try new languages. 😉

Extracting YouTube video IDs from strings

Ways to extract video IDs from YouTube shareable strings, using RegExp, in different languages. For training.

@yuigoto
yuigoto / sixsided.css
Last active April 11, 2020 18:07
[Markdown Style : SIXSIDED] A general-purpose Markdown stylesheet, created for my own use in Markdown Pad 2.
/**
* SIXSIDED : a general-purpose Markdown stylesheet
* ----------------------------------------------------------------------
* Originally made for use with MarkdownPad (http://markdownpad.com).
*
* Mostly based on Nicolas Hery's stylesheet for MDPad2, available at:
* https://github.com/nicolashery/markdownpad-github
*
* Author: Fabio Y. Goto - https://yuiti.com.br | https://github.com/yuigoto
* Version: 1.0.0
@yuigoto
yuigoto / Facebook.js
Created May 25, 2020 20:53 — forked from recca0120/Facebook.js
Facebook Promise Wrapper
'use strict';
export class Facebook {
getScript() {
return new Promise((resolve) => {
if (window.FB) {
resolve(window.FB);
}
const id = 'facebook-jssdk';
html{font-family:-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,Helvetica,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";box-sizing:border-box;overflow:auto;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{font-family:inherit;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}*,:after,:before{box-sizing:inherit;margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:400}b,strong{font-weight:700}cite,em,i{font-style:oblique}small{font-size:80%}code,kbd,pre,samp,var{font-family:"SF Mono",Menlo,Consolas,"Lucida Console","Ubuntu Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono",Monaco,"Courier New",Courier,monospace;font-size:1rem}pre{word-wrap:break-word;white-space:pre-wrap}pre code{color:inherit;background:0 0;border:0;margin:0;padding:0}sub,sup{font-size:75%;line-height:0;vertical-align:baseline;positi