Skip to content

Instantly share code, notes, and snippets.

View helloncanella's full-sized avatar

Hellon Canella helloncanella

  • Peats GmbH
  • Rio de Janeiro
View GitHub Profile
@helloncanella
helloncanella / Study-tests-of-Bootstrap.markdown
Created January 29, 2015 02:52
Study tests of Bootstrap
@helloncanella
helloncanella / tny
Last active September 13, 2015 03:28 — forked from gbl08ma/tny
Unix shell script to shorten URLs with tny.im URL shortener. wget must be installed for this to work.
#!/bin/sh
if [ -t 0 ]; then
if [ -z "$1" ]; then
echo "usage: tny long_url [custom_keyword]"
echo ""
echo "Shorten URLs with tny.im URL shortener"
echo "This script expects a long URL to shorten either as an argument or passed through STDIN."
echo "When using arguments, an optional second argument can be provided to customize the later part of the short URL (keyword)."
exit 1
fi
@helloncanella
helloncanella / underscore.move.js
Created April 2, 2016 03:09 — forked from kjantzer/underscore.move.js
Underscore.js Mixin: Move - takes array and moves item at index and moves to another index; great for use with jQuery.sortable()
/*
_.move - takes array and moves item at index and moves to another index; great for use with jQuery.sortable()
*/
_.mixin({
move: function (array, fromIndex, toIndex) {
array.splice(toIndex, 0, array.splice(fromIndex, 1)[0] );
return array;
}
<link href="https://fonts.googleapis.com/css?family=Dosis:400,500" rel="stylesheet">
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 988.9 659.3" style="enable-background:new 0 0 988.9 659.3;" xml:space="preserve">
<style type="text/css">
.st0{fill:white; fill-opacity:0; stroke-width:1.0;stroke-miterlimit:10; stroke: white}
.st1{fill:url(#SVGID_1_);}
.st2{fill:url(#SVGID_2_);}
.st3{fill:url(#SVGID_3_);}
.st4{fill:url(#SVGID_4_);}
@helloncanella
helloncanella / iconElementLeft.tsx
Last active August 26, 2016 23:12
The attribute `iconElementLeft` isn't working. The desired action is triggered just when the `<IconButton>` receives the attribute `onTouchTap`
import * as React from 'react'
import { AppBar, FontIcon, IconButton } from 'material-ui'
import {browserHistory} from 'react-router'
function _backHistory(){
console.log('hello')
alert('hello')
browserHistory.push('./home')
}
@helloncanella
helloncanella / i18n-example.jsx
Created September 26, 2016 20:53
A i18n example using Meteor and React
import React, {Component} from 'react'
import i18n from 'meteor/universe:i18n';
import {supportedLanguages} from '/i18n/_supported_languages'
import { Session } from 'meteor/session'
import { Tracker } from 'meteor/tracker'
import _ from 'lodash'
const T = i18n.createComponent();
Meteor.startup(()=>{
import React from 'react'
import {Loading} from '/client/pages/loading/loading.jsx'
import {Translations} from '/lib/collections/translations'
import {Session} from '/meteor/session'
export class TranslatorComponent extends Component{
render(){
return(
@helloncanella
helloncanella / fluid-grid.scss
Created December 6, 2016 04:13
Fluid grid mixin
@mixin fluid-grid($cols:12, $gutter:1%, $grid-max-width:960px, $internal-lateral-padding:5%) {
.grid {
max-width: #{$grid-max-width};
margin: 0 auto;
padding: 0 #{$internal-lateral-padding};
&>* {
float: left;
}
@include clearFloat()
@helloncanella
helloncanella / toUTF8.js
Last active January 1, 2017 01:43
latin1 to utf-8
fetch('http://www.band.uol.com.br/rss/colunista_64.xml').then(res=>res.arrayBuffer()})
.then(arrayBuffer => iconv.decode(new Buffer(arrayBuffer), 'iso-8859-1').toString())
.then(converted => console.log(converted))
@helloncanella
helloncanella / flatten.js
Last active February 4, 2017 22:02
flatten an array
function flatten(A) {
let flattened = []
A.forEach(item => {
if (Array.isArray(item)) item = flatten(item)
flattened = flattened.concat(item)
})
return flattened
}