Skip to content

Instantly share code, notes, and snippets.

View plcosta's full-sized avatar

Pedro Costa plcosta

  • Brazil
View GitHub Profile
@plcosta
plcosta / Bed.php
Created March 3, 2016 08:39
Lumen bug?
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Bed extends Model
{
}
<div class="col-md-4" v-for="(index, group) in wards" track-by="$index">
<div class="ibox">
<div class="ibox-title"><strong>{{ index }}</strong></div>
<div class="ibox-content">
<div class="col-md-2 bed" v-for="patient in group">
<a v-link="" v-if="patient.id" class="bed-default">{{ patient.bed_id }}</a>
</div>
</div>
</div>
</div>
@plcosta
plcosta / dnsmasq OS X.md
Created September 27, 2016 13:39 — forked from ogrrd/dnsmasq OS X.md
Setup dnsmasq on OS X

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.dev domains, e.g. project.dev, awesome.dev and so on, without having to add to your hosts file each time.

Requirements

Install

@plcosta
plcosta / nginx.conf
Last active July 11, 2017 14:24
nginx conf for uploads directory - development/staging environment - get uploads from production
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
...
...
...
# Matches any URL containing /wp-content/uploads/ or /app/uploads/ (using bedrock)
location ~ "^(.*)/app/uploads/(.*)$" {
try_files $uri @prod_serv;
@plcosta
plcosta / dynamic-facebook-comments.js
Created July 31, 2017 15:41 — forked from mjangda/dynamic-facebook-comments.js
Dynamically load Facebook comments on your site (if you already have the FB API running)
jQuery( function( $ ) {
if ( 'undefined' === typeof FB )
return;
if ( $( 'body' ).hasClass( 'single-post' ) || $( 'body' ).hasClass( 'page' ) ) {
var $comments_div = $( '<div/>' );
$comments_div.addClass( 'fb-comments' );
$comments_div.attr( 'data-href', document.location );
$comments_div.appendTo( $( '.primary-content' ) );
@plcosta
plcosta / query.sql
Last active September 14, 2017 15:34
Move Discourse Topics from one category to another
-- cd /var/discourse
-- ./launcher enter app
-- su discourse
-- psql
-- MOVE TOPICS CATEGORY
-- CURRENT CATEGORY: 1
-- NEW CATEGORY: 2
UPDATE topics SET category_id = 2 WHERE category_id = 1;
@plcosta
plcosta / git.md
Created February 9, 2018 18:38 — forked from twoism-dev/git.md
Hybrid Git Flow

Our Git Flow

We are using a simple git flow based on git flow and github flow. We have two branches develop and master.

develop is a representation of staging

master is a representation of production

The Rules

@plcosta
plcosta / routes.rb
Created May 12, 2018 11:39
Nested Routes
resources :courses, except: :show do
resources :chapters, except: :show do
resources :lessons, except: :show do
resources :attachments, except: :show
end
end
end
@plcosta
plcosta / script.js
Created July 31, 2018 04:06
Discourse - Custom Categories Topics List
<script type='text/x-handlebars' data-template-name='components/latest-topic-list-item'>
<table>
<tbody>
<tr data-topic-id={{topic.id}} class="{{if topic.archived 'archived'}}">
<td class="main-link">
<tr>
{{raw "topic-status" topic=topic}}
{{topic-link topic}}
{{#if topic.featured_link}}
@plcosta
plcosta / postcss.config.js
Created December 7, 2018 00:10
PostCSS Config - TailwindCSS, Vuetify and PurgeCSS
const tailwindcss = require('tailwindcss')
const autoprefixer = require('autoprefixer')
const purgecss = require('@fullhuman/postcss-purgecss')
module.exports = {
plugins: [
tailwindcss('./tailwind.js'),
autoprefixer({
add: true,
grid: true