Skip to content

Instantly share code, notes, and snippets.

View dptole's full-sized avatar

dptole

View GitHub Profile
@dptole
dptole / webgl-2d-square.html
Last active August 24, 2020 09:45
WebGL standalone example: 2D square (js) https://jsfiddle.net/jLo12nr5/
<!-- https://jsfiddle.net/jLo12nr5/ -->
<!doctype html>
<html>
<head>
<!-- https://webglfundamentals.org/ -->
<style>
@dptole
dptole / webgl-3d-cube.html
Last active August 24, 2020 09:45
WebGL standalone example: 3D cube (js) https://jsfiddle.net/4bdwavo0/
<!-- https://jsfiddle.net/4bdwavo0/ -->
<!doctype html>
<html>
<head>
<!-- https://webglfundamentals.org/ -->
<style>
@dptole
dptole / cartesian-plane.elm
Last active August 24, 2020 09:45
WebGL standalone example: Cartesian plane (elm) https://ellie-app.com/7CqD92dY2cza1
-- https://ellie-app.com/7CqD92dY2cza1
-- https://webglfundamentals.org/
-- elm install elm-explorations/linear-algebra
-- elm install elm-explorations/webgl
module Main exposing (..)
import Browser
import Html
module Main exposing (main)
import Browser
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Html.Keyed
import Http
import Json.Decode exposing (Decoder, field, string, dict, map2)
@dptole
dptole / Preferences.sublime-settings
Last active November 3, 2019 02:33
My sublime preferences
{
"animation_enabled": false,
"auto_close_tags": false,
"auto_complete": false,
"auto_complete_commit_on_tab": false,
"auto_complete_with_fields": false,
"auto_indent": false,
"auto_match_enabled": false,
"caret_style": "blink",
@dptole
dptole / numero-para-texto.php
Created October 10, 2019 23:57
Converter números para texto em PHP
<?php
// UDC = Unidade Dezena Centena
function numeroParaTextoUDC($numero) {
$_ucd = "$numero";
while(strlen($_ucd) < 3)
$_ucd = "0$_ucd";
switch(+$_ucd) {
case 0: return array("zero");
@dptole
dptole / dynamic_decorator.py
Last active March 21, 2019 00:50
Dynamically add decorators into python functions
# -*- coding: utf-8 -*-
"""
$ python dynamic_decorator.py
func_to_be_dynamically_decorated(1, 2)
3
unreg = add_dynamic_decorator('func_to_be_dynamically_decorated', dynamic_decorator_1)
<function unreg at 0x7f5260d1f9b0>
func_to_be_dynamically_decorated(1, 2)
4
@dptole
dptole / docker-fix.sh
Last active August 24, 2020 09:47
Fix docker container when it can't connect to the internet https://stackoverflow.com/a/20431030
# Source
# https://stackoverflow.com/a/20431030
# Turn off docker service
sudo service docker stop
# Delete iptables
sudo iptables -t nat -F
# Bring docker ethernet interface down
@dptole
dptole / letsencrypt-certbot-certonly.sh
Last active January 9, 2019 15:48
Generate your free certificate with Let's Encrypt! https://letsencrypt.org/
#!/bin/bash
# Created at 2018-10-15
# CHECKUPS
echo "LAST CHANCE TO BACK UP YOUR OLD CERTIFICATES!"
echo ""
read
echo "THE DESIGNATED DOMAIN MUST BE ACCESSIBLE FROM THE INTERNET FOR OWNERSHIP VERIFICATION!"
@dptole
dptole / Zumber.js
Last active November 28, 2019 14:17
Zumber, weird numbers.
-function() {
function Zumber(array) {
if(!(this instanceof Zumber))
return new Zumber(array);
if(!(
array instanceof Array &&
array.length > 10 &&
array.every(function(item, index) {
return typeof(item) === 'string' && item.length === 1 && !~array.indexOf(item, index + 1);