Skip to content

Instantly share code, notes, and snippets.

View almino's full-sized avatar

Almino almino

View GitHub Profile
@almino
almino / gist:2a62cfa8101628ff8bc6
Created August 19, 2014 14:59
Forçar UTF-8 no CodeIgniter
<?php
/*
* ---------------------------------------------------------------
* Always UTF-8
* ---------------------------------------------------------------
* http://stackoverflow.com/a/4279294
*/
header('Content-Type: text/html; charset=utf-8');
@almino
almino / menu.php
Created February 27, 2016 23:47
Menu HTML usando classes personalizadas
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/* @var $this CI_Loader */
if ($this->session->has_userdata('event')) {
$this->model('evento_model', 'evento_model');
$this->helper(array('text'));
$container = new \OOBootstrap\Nav\StackedPillsContainer();
@almino
almino / browser-sync.js
Last active March 15, 2017 19:38
Tampermonkey Browser-sync
// ==UserScript==
// @name Browser-sync append script
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Insert a script tag on a document
// @author Almino Melo <almino.melo@gmail.com>
// @match http://localhost:3000/*
// @match http://200.129.37.8:3000/*
// @require https://code.jquery.com/jquery-3.1.1.min.js
// @grant none
@almino
almino / hdmi_5.1.sh
Last active July 1, 2017 14:10
Change sound card to HDMI 5.1 (Dell XPS 15 5000 Ubuntu 16.04)
#!/bin/bash
pactl set-card-profile 0 output:hdmi-surround+input:analog-stereo
@almino
almino / stereo_2.0.sh
Created July 1, 2017 14:10
Change sound card to Analog Stereo (Dell XPS 15 5000 Ubuntu 16.04)
#!/bin/bash
pactl set-card-profile 0 output:analog-stereo+input:analog-stereo
@almino
almino / Resources_Topic.php
Last active September 26, 2017 10:39
Topics resource
<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\Resource;
class Topic extends Resource
{
/**
* Transform the resource into an array.
@almino
almino / Input.vue
Last active September 26, 2017 10:40
Vue component for .ui.input
<template lang="html">
<div v-bind:class="['ui', { 'disabled' : disabled }, iconClasses(), 'input', { 'focus' : focus }, { 'loading' : dLoading }, { 'error' : error }]">
<input v-bind:type="'text'" v-bind:placeholder="placeholder" v-bind:disabled="disabled"
ref="input" v-bind:value="value" v-on:input="updateValue($event.target.value)">
<i v-bind:class="[dIcon.value, 'icon']" v-if="dIcon.value"></i>
</div>
</template>
<script>
import Input from '../mixins/common/input.js'
@almino
almino / focus.events.js
Last active October 21, 2017 21:13
Input mixins for VueJS 2 components
module.exports = {
methods: {
// v-on:focus="emitFocus"
emitFocus: function() {
this.$emit('focus')
},
// v-on:blur="emitBlur"
emitBlur: function() {
this.$emit('blur')
},
@almino
almino / gist:eb4bd752b0ca580d9d6c
Last active November 26, 2017 04:07 — forked from commix/gist:1287276
PHP: Validate - Human Name
/**
* Validate a Human Name
*
* @param $name
* A name as a string.
* @return
* TRUE or FALSE if name is a valid human name.
*/
function valid_human_name($name) {
# Matches names like "Ítalo", "Édith"
@almino
almino / data-model.ts
Last active March 19, 2018 02:08
Meus primeiros passos com Firestore
import { Address } from 'ngx-google-places-autocomplete/objects/address';
export interface Price {
value: number
date: Date
place?: Address
url?: URL
}
export interface Measurement {