Skip to content

Instantly share code, notes, and snippets.

View cristianoliveira's full-sized avatar
😁
Foo bar

Cristian Oliveira cristianoliveira

😁
Foo bar
View GitHub Profile
@cristianoliveira
cristianoliveira / CountryAddressForm.js
Last active April 5, 2018 05:58
Same same but different - post
// CountryAddressForm.js
render() {
return (
<form action="#"
onSubmit={this.handleSubmit.bind(this)}
onChange={this.handleChange.bind(this)}>
<CountrySelector name="country" countries={countries} />
<AddressLineInput name="address_line" value={this.state.address_line} />
@cristianoliveira
cristianoliveira / CountryAddressForm.js
Last active April 5, 2018 05:57
country address form
// CountryAddressForm.js
// Common most used address format
// ...
render() {
return (
<form action="#"
onSubmit={this.handleSubmit.bind(this)}
onChange={this.handleChange.bind(this)}>
@cristianoliveira
cristianoliveira / AGeneraInternationalAddress.js
Last active April 3, 2018 17:45
Same same but different - post
// This is the common field set free of country specific things.
function GeneralInternationalAddress(props) {
return (
<Fragment>
<AddressLineInput value={props.address_line} />
<AddressLineInput
name="address_line2"
value={props.address_line2}
optional
@cristianoliveira
cristianoliveira / CountryAddressForm.js
Last active April 2, 2018 22:31
Same same but different - post
// CountryAddressForm.js
return (
<form
className="country-form"
action="#"
method="post"
onSubmit={this.handleSubmit.bind(this)}
onChange={this.handleChange.bind(this)}>
@cristianoliveira
cristianoliveira / map_copy.go
Created February 27, 2018 15:00
Go map copy
package main
import (
"bytes"
"encoding/gob"
"fmt"
"log"
)
func main() {
@cristianoliveira
cristianoliveira / cron.sh
Created October 5, 2016 20:47
Run your command each time
#!/bin/bash
# usage: cron.sh <your_command> <sleep_duration>
while :;
do
clear
date
$1
sleep $2
done
require 'test/unit'
require_relative 'fizzbuzz.rb'
class FizzBuzzTest < Test::Unit::TestCase
def test_given_tree_it_should_print_fizz
#given
number = 3
expected = "Fizz"
#when
result = FizzBuzz.when(number)
class TestFeedCollectionHandler(FeedServerTestCase):
headers = {'Content-Type': 'application/json'}
def setUp(self):
super(TestFeedCollectionHandler, self).setUp()
self.data = {'uri': 'glb.com/minhaeditoria/',
'product': 'glb-feed',
'name': 'globo feed',
'images': {},
@cristianoliveira
cristianoliveira / music_folder_sorter.rb
Last active June 6, 2016 03:48
Music folder sorter
require 'fileutils'
musics = Dir["*.mp3"]
musics.each do |music|
band_name = music.split("-").first
dir_destiny = "#{band_name}/"
Dir.mkdir(band_name) unless File.exists? band_name
FileUtils.mv music, dir_destiny
end
use std::net::UdpSocket;
extern crate rustc_serialize;
use rustc_serialize::json;
use std::str;
use std::string::String;
fn main() {
match main_loop() {
Err(e) => panic!(e),
_ => ()