Skip to content

Instantly share code, notes, and snippets.

View suissa's full-sized avatar
🏠
Working from home

Jean Carlo Nascimento suissa

🏠
Working from home
  • Suissa Corp
  • Brasil
View GitHub Profile
@suissa
suissa / Calisthenics.md
Last active September 4, 2023 19:55 — forked from bobuss/Calisthenics.md
As 9 Regras do Object Calisthenics

Object Calisthenics descreve 9 regras básicas - pt-br

  1. Um nível de recuo por método.
  2. Não use a palavra-chave ELSE.
  3. Envolver todos os primitivos e Strings em classes. (em JS nao eh necessario)
  4. Funções de primeira classe // mudei p/ Function em vez de Class
  5. Um ponto por linha.
  6. Não abrevie.
  7. Mantenha todas os módulos com menos de 50 linhas.
  8. Nenhuma função com mais de dois parâmetros.
@suissa
suissa / multiple_upload
Created June 19, 2011 19:19
html multiple upload files
<form method="post" action="upload.php" enctype="multipart/form-data">
<input name='uploads[]' type="file" multiple>
<input type="submit" value="Send">
</form>
<?php
/*upload*/
foreach ($_FILES['uploads']['name'] as $filename) {
echo '<li>' . $filename . '</li>';
@suissa
suissa / watermark.js
Last active June 12, 2023 10:07
Add watermark with Node.js and ffmpeg
var ffmpeg = require('ffmpeg');
try {
var process = new ffmpeg('example.mp4');
process.then(function (video) {
console.log('The video is ready to be processed');
var watermarkPath = 'watermark-suissa.png',
newFilepath = './video-com-watermark.mp4',
settings = {
position : "SE" // Position: NE NC NW SE SC SW C CE CW
@suissa
suissa / uptime.erl
Created April 8, 2022 01:51 — forked from seriyps/uptime.erl
Uptime of Erlang node
-export([uptime/0, uptime/1, uptime_string/0]).
%% @doc uptime in native time units
uptime() ->
erlang:monotonic_time() - erlang:system_info(start_time).
%% @doc uptime in specified time units
uptime(Unit) ->
erlang:convert_time_unit(uptime(), native, Unit).
@suissa
suissa / round.decimal.js
Created March 12, 2022 22:31
Função para arredondar decimal q peguei na WEB, ainda vou melhorar
// Closure
(function() {
/**
* Decimal adjustment of a number.
*
* @param {String} type The type of adjustment.
* @param {Number} value The number.
* @param {Integer} exp The exponent (the 10 logarithm of the adjustment base).
* @returns {Number} The adjusted value.
*/
@suissa
suissa / free-photoshop.md
Created May 13, 2019 20:11 — forked from molcik/free-photoshop.md
Modify Photoshop to never ending trial

How Does It Work

All you have to do, to extend your trial period, is change number in TrialKey element in application.xml. This file is located in /Library/Application Support/Adobe/Adobe Photoshop/AMT. You can navigate there with this command:

cd /Library/Application\ Support/Adobe/Adobe\ Photoshop\ */AMT

Then you have to open the file and edit it. You can use just TextEdit app.

open -a TextEdit application.xml
function trampoline(f) {
return function trampolined(...args) {
let result = f.bind(null, ...args);
while (typeof result === 'function') result = result();
return result;
};
}
function trampoline(f) {
return function trampolined(...args) {
let result = f.bind(null, ...args);
while (typeof result === 'function') result = result();
return result;
};
}
// Discord all events!
// A quick and dirty fleshing out of the discord.js event listeners (not tested at all!)
// listed here -> https://discord.js.org/#/docs/main/stable/class/Client
// Learn from this, do not just copy it mofo!
//
// Saved to -> https://gist.github.com/koad/316b265a91d933fd1b62dddfcc3ff584
/*
koad-was-here
@suissa
suissa / beerSchema.js
Created September 23, 2014 05:07
Creating models dynamically
var mongoose = require('mongoose');
var BeerSchema = new mongoose.Schema({
id: { type: Number, min: 0},
name: { type: String, default: '' },
description: { type: String, default: '' },
abv: { type: Number, min: 0},
category: { type: String, default: ''},
created_at: { type: Date, default: Date.now },
updated_at: { type: Date, default: Date.now }