Skip to content

Instantly share code, notes, and snippets.

View leohmoraes's full-sized avatar
🏠
Working/Learning and Hackathon from home

Léo Moraes leohmoraes

🏠
Working/Learning and Hackathon from home
View GitHub Profile
@leohmoraes
leohmoraes / main.dart
Last active August 15, 2020 19:20
Ep03 - Dart - Funcoes puras e transparencia referencial
//https://youtu.be/4EzUtx-Q58I?t=1769
//Funcoes puras e transparencia referencial
import 'dart:math';
/// Funcao pura = sem side-effects
/// Altera somente as variaveis intenas
/// Doubles [n].
int double(int n) => n * 2;
@leohmoraes
leohmoraes / main.dart
Last active August 13, 2020 03:35
dart2 - High Order Function
// https://youtu.be/4EzUtx-Q58I?t=1370
// High-order Function
int MyInt = 10;
// Add 1 to [1] //adiciona 1
int add1(int a) => a + 1;
//Halve [a] //metade
@leohmoraes
leohmoraes / main.dart
Last active August 13, 2020 03:37
Dart Ep01 - Exemplo de Lambda com Dart
void main() {
// for (int i = 0; i < 5; i++) {
// print('hello ${i + 1}');
// }
print((True));
print((False));
print("NOT");
print(not(True));
import 'dart:async';
import 'dart:math' as math;
import 'package:flutter/material.dart';
class AirHockey extends StatefulWidget {
@override
_AirHockeyState createState() => _AirHockeyState();
}
@leohmoraes
leohmoraes / youtube.bash
Created May 12, 2020 04:09 — forked from seanbehan/youtube.bash
Upload videos to Youtube.com with bash
#!/bin/sh
#
# Bash script for uploading videos to Youtube.com
#
# Usage:
# ./youtube.bash path-to-movie-movie.mov
#
# Setup
# Goto https://console.developers.google.com
# Create app, enable Youtube Data API and create OAuth credentials, client id and client secret.
@leohmoraes
leohmoraes / web-servers.md
Created May 12, 2020 03:47 — forked from cferdinandi/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@leohmoraes
leohmoraes / Spinner.js
Created April 28, 2020 04:45 — forked from LauraBeatris/Spinner.js
Roullete Spinner made with React Hooks
const spinWheel = useCallback(() => {
// Receives the winner prop and search for his position in the spinner bets array
const order = [8, 1, 14, 2, 13, 3, 12, 4, 0, 11, 5, 10, 6, 9, 7];
const position = order.indexOf(winner);
// Determine position where to land
const rows = 12;
const card = 80 + 2 * 2;
let landingPosition = rows * 15 * card + position * card;
@leohmoraes
leohmoraes / gist:13b3d4b2831829362d7f10b80f35ea04
Created April 23, 2020 04:54 — forked from tlack/gist:5094559
example of proxying https -> http
location / { # ~ domain=(.*)& {
rewrite_log on;
if ( $arg_callback ) {
echo_before_body '$arg_callback(';
echo_after_body ');';
}
if ($args ~ "domain=(.*)&") {
set $key1 $1;
echo_before_body "$arg_callback(";
# proxy_pass http://whois.api.go.co/blah=$key1;