Skip to content

Instantly share code, notes, and snippets.

View yurimorales's full-sized avatar

Yuri Morales yurimorales

  • Palhoça, SC - Brazil
View GitHub Profile
@yurimorales
yurimorales / .bashrc
Created January 3, 2018 19:45 — forked from marioBonales/.bashrc
Default .bashrc for ubuntu
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
@yurimorales
yurimorales / read-long-file.php
Last active March 18, 2024 15:38 — forked from fj/gist:1597544
Slightly nicer way of writing large files to disk with PHP
<?php
// Copy big file from somewhere else
$src_filepath = 'http://example.com/all_the_things.txt'; //$src = fopen($src_filepath, 'r');
$tmp_filepath = '...'; // $tmp = fopen($tmp_filepath, 'w');
$buffer_size = 1024;
while (!feof($src)) {
$buffer = fread($src, $buffer_size); // Read big file/data source/etc. in small chunks
fwrite($tmp, $buffer); // Write in small chunks
}
package main
import (
"fmt"
"strings"
)
func reverseString(s string) string {
if len(s) > 0 {
newSlice := strings.Split(s, " ")
@yurimorales
yurimorales / golang-nuts.go
Created October 17, 2017 13:30 — forked from ryanfitz/golang-nuts.go
two ways to call a function every 2 seconds
package main
import (
"fmt"
"time"
)
// Suggestions from golang-nuts
// http://play.golang.org/p/Ctg3_AQisl
@yurimorales
yurimorales / ramdomNumberInterval.go
Created October 11, 2017 20:06
Random Number Go
package main
import (
"fmt"
"math/rand"
"time"
)
func randomNumber(min int, max int) int {
@yurimorales
yurimorales / fizzBuzz.js
Last active February 17, 2025 19:32
Map Array to FizzBuzz test Javascript
const numbers = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
const fizzBuzz = (x) => {
if (x % 15 == 0) {
return 'FizzBuzz';
} else if(x % 5 == 0) {
return 'Buzz';
} else if(x % 3 == 0) {
return 'Fizz';
} else {
return '';