Skip to content

Instantly share code, notes, and snippets.

View wilcorrea's full-sized avatar
🚀
// TODO: be life good

William Correa wilcorrea

🚀
// TODO: be life good
View GitHub Profile
@wilcorrea
wilcorrea / index.html
Created August 9, 2016 20:15 — forked from k33g/index.html
Vue.js + ES6
<div id="demo">
<h1>{{bob.fields.firstName}} {{bob.fields.lastName}}</h1>
</div>
<ul id="humans-list">
<li v-repeat="humans">
{{fields.firstName}} {{fields.lastName}}
</li>
</ul>
@lubien
lubien / show-me.js
Last active March 14, 2017 17:26 — forked from ronaiza-cardoso/show-me.js
Show Me the Evens - Show me the Odds
/**
* Show Me the Evens - Show me the Odds
* Diana is learning to count and she just learned the difference between odds and even numbers.
* She wants to have some fun, so she picks a random number.
* If that number is even, she decides to count all the even numbers up to it starting from 0 up to (but not including) the input.
* If not, she decides to count all the odd numbers up to that number starting from 1 (but not including) the input.
**/
const
range = x => y =>
@lubien
lubien / primeNumbers.js
Last active March 14, 2017 19:40 — forked from Woodsphreaker/primeNumbers.js
Dado um número aleatório, retornar todos os números PRIMOS entre 0 e o número escolhido
const
range = x => y =>
Array.from({length: y - x})
.map((_, i) => x + i)
, {ceil, sqrt} = Math
, lt = y => x =>
x < y
/**
* Show Me the Evens - Show me the Odds
* Diana is learning to count and she just learned the difference between odds and even numbers.
* She wants to have some fun, so she picks a random number.
* If that number is even, she decides to count all the even numbers up to it starting from 0 up to (but not including) the input.
* If not, she decides to count all the odd numbers up to that number starting from 1 (but not including) the input.
**/
const counting = (x) => {
return arrayFrom(x)
/**
* By Rogério M. de Queiroz(rogerio.mq@gmail.com)
* https://github.com/rogeriomq
* Funções de filtros diversos.
* Código inspirado nos .js de igorcosta/ng-filters-br:
* https://github.com/igorcosta/ng-filters-br/tree/master/src/brasil/filters
*/
const cpfFormatter = (input) => {
let str = input + ''
@jhorlima
jhorlima / DiggStylePagination.php
Last active March 20, 2018 13:10
Digg Style Pagination - Bootstrap PHP
<?php
final class DiggStylePagination {
/**
* DiggStylePagination::create(5, 1, 15, function($page){ return 'http://localhost/' . $page; })
*
*
*/
public final static function create($currentPage, $firstPage, $totalPages, \Closure $url, $adjacents = 1, array $classes = []) {
@almino
almino / human-name-shortcode.php
Last active June 14, 2018 19:17
WordPress human name ucwords shortcode (apply correct cases for human names)
<?php
# Include this file in your functions.php
add_shortcode('human-name', 'human_name');
add_shortcode('human_name', 'human_name');
add_shortcode('name', 'human_name');
function human_name($atts, $content = null) {
return HumanName::parse($content);
@IgorDePaula
IgorDePaula / parse_yaml.sh
Created June 14, 2018 20:27 — forked from pkuczynski/parse_yaml.sh
Read YAML file from Bash script
#!/bin/sh
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
function formatTime (timeInMs) {
let date = new Date(timeInMs)
// ${date.getDate()}/${date.getMonth()}/${date.getFullYear()}
return `${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}.${date.getMilliseconds()}`
}
function log (type, ...args) {
if (this.$options.debug) {
console[type](`%c[${this.$_id}]${formatTime(Date.now())}>> `,
`background:${type === 'log' ? '#384A5E' : type === 'warn' ? '#F1BF39' : '#FF5370'}; padding: 3px; border-radius: 3px; color: #fff`,
@luiguild
luiguild / logger.js
Last active November 16, 2018 18:03
Simple logger module and VuePlugin that check NODE_ENV to show console.log()
const prefix = process.env.PREFIX
const nodeEnv = process.env.NODE_ENV
let logCounter = 0
let errorCounter = 0
let fatalCounter = 0
let warnCounter = 0
export const vLogger = {
install (Vue, options) {