Skip to content

Instantly share code, notes, and snippets.

View victorkurauchi's full-sized avatar
🎯
Focusing

Victor Kurauchi victorkurauchi

🎯
Focusing
View GitHub Profile
// Media Queries in Sass 3.2
//
// These mixins make media queries a breeze with Sass.
// The media queries from mobile up until desktop all
// trigger at different points along the way
//
// And important point to remember is that and width
// over the portrait width is considered to be part of the
// landscape width. This allows us to capture widths of devices
// that might not fit the dimensions exactly. This means the break
@victorkurauchi
victorkurauchi / handle_file_upload.php
Created March 8, 2017 17:59 — forked from ebidel/handle_file_upload.php
Uploading files using xhr.send(FormData) to PHP server
<?php
$fileName = $_FILES['afile']['name'];
$fileType = $_FILES['afile']['type'];
$fileContent = file_get_contents($_FILES['afile']['tmp_name']);
$dataUrl = 'data:' . $fileType . ';base64,' . base64_encode($fileContent);
$json = json_encode(array(
'name' => $fileName,
'type' => $fileType,
'dataUrl' => $dataUrl,
@victorkurauchi
victorkurauchi / Git push deployment in 7 easy steps.md
Last active August 30, 2017 18:35 — forked from thomasfr/Git push deployment in 7 easy steps.md
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
@victorkurauchi
victorkurauchi / PilhaInteiros.js
Last active August 9, 2017 02:36
Javascript arr methods Big O
class PilhaInteiros {
constructor (arr) {
// ex new PilhaInteiros([1, 3, 6, 8])
this.pilha = arr
if (arr && arr.length) {
let minIdx
arr.forEach((n, idx) => {
if (typeof minIdx == 'undefined') {
minIdx = idx
@victorkurauchi
victorkurauchi / gist:78b5a4ea38a832fd36bb249d451dc2ff
Created September 21, 2017 17:16 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@victorkurauchi
victorkurauchi / app.js
Created October 6, 2017 20:54
Reactjs render components dynamically with es6
renderByJSON(requests) {
let templateComponents = []
requests.map(request => {
request.exames.map(exam => {
let examComponent = exam.name;
let folder = humps.decamelize(examComponent, { separator: '-' });
let Component = require(`./templates/${folder}/${examComponent}`).default;
templateComponents.push(Component);
});
});
@victorkurauchi
victorkurauchi / spark.py
Created October 11, 2017 16:14
using lambda with python to transform dataset
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
dataset = sc.textFile("file:///home/cloudera/massa_de_exemplo_wol.txt")
categories = []
regex = r"(\/[^, z]*\.[a-z]\w)+"
result = dataset.map(lambda line: re.search(regex, line).group(0).split('/')[1])
# print result
@victorkurauchi
victorkurauchi / transform.py
Last active October 12, 2017 23:27
Buscando resultados SQL (aqui considerando o .csv) via Python e obtendo ocorrências, e quantidade de reincidentes.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import Counter
from itertools import groupby, islice
import csv
# connection to database should be here
# .csv should be the result from database
#
# line example
@victorkurauchi
victorkurauchi / list1.R
Created October 20, 2017 00:38
just a few exercises with r language
# lista
#1
x <- (sqrt(16)/2* 3^2) / 2 * (9-2^3)
x
#2
y <- -(-2^3) + (-1)^0 - sqrt(25-(3^2)) - 5^3/25
y
#3
@victorkurauchi
victorkurauchi / ErrorBoundary.js
Created October 20, 2017 15:21
Using error boundaries in react 0.16
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { logError } from '../../store/actions/error';
class ErrorBoundary extends Component {
constructor(props) {
super(props);
this.state = { error: null, errorInfo: null };
}