Skip to content

Instantly share code, notes, and snippets.

Bruno Fernando dos Santos Silva 3runoDesign

Block or report user

Report or block 3runoDesign

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View docker.shell
#!/bin/bash
if docker network ls | grep nginx-proxy; then
echo 'network found'
else
echo 'network not found';
docker network create nginx-proxy
fi
if docker ps | grep nginx-proxy; then
@3runoDesign
3runoDesign / EloquentCheatSheet.md
Created Oct 22, 2018 — forked from avataru/EloquentCheatSheet.md
Eloquent relationships cheat sheet
View EloquentCheatSheet.md
View laravel-pivot-seeder.php
<?php
use Guiaa\Models\Segments;
use Guiaa\Models\SegmentTags;
use Guiaa\Models\Tags;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class SegmentTagsSeeder extends Seeder
{
@3runoDesign
3runoDesign / functions.php
Last active Sep 22, 2018
Create custom page based on URL rewriting
View functions.php
<?php
// https://codex.wordpress.org/Class_Reference/WP_Rewrite
// https://codex.wordpress.org/Rewrite_API/flush_rules
// https://codex.wordpress.org/Plugin_API/Action_Reference/generate_rewrite_rules
add_filter( 'generate_rewrite_rules', function ( $wp_rewrite ) {
$wp_rewrite->rules = array_merge(
['my-route/?$' => 'index.php?param_internal=1'],
$wp_rewrite->rules
View gist:55f98cc526444c6c732f34a55dcfeca7
<?php
function attachments_per_post( $where ){
if( is_user_logged_in() ){
if( isset( $_POST['action'] ) ){
// library query
if( $_POST['action'] == 'query-attachments' ){
$where .= ' AND post_parent != 0';
}
}
@3runoDesign
3runoDesign / intro.markdown
Created Feb 4, 2018 — forked from tillsanders/intro.markdown
Laravel: drag-and-drop repositioning with auto-save of DB entries
View intro.markdown

Laravel: drag-and-drop repositioning with auto-save of DB entries

Use case: Database entries are represented in a table. By grabbing and moving a row up or down the table, you can change the entries' order/position. The changes are submitted automatically via ajax.

  • Uses jQueryUI (custom download: sortable is needed)
  • newly created elements are added to the top (see route /jobs/create)
View .htaccess
#Força a utilizar Cache-Control e Expires header
<IfModule mod_headers.c>
Header unset ETag
</IfModule>
FileETag None
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 month"
ExpiresByType text/cache-manifest "access plus 0 seconds"
# Html
@3runoDesign
3runoDesign / Vagrantfile
Created Jul 18, 2017
Setting vagrant-hostmanager
View Vagrantfile
if Vagrant.has_plugin? 'vagrant-hostmanager'
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.manage_guest = true
config.vm.provision :hostmanager
settings = YAML::load(File.read(homesteadYamlPath))
config.hostmanager.aliases = settings['sites'].map { |item| item['map'] }
puts "hostmanager aliases: " + config.hostmanager.aliases.join(' ')
@3runoDesign
3runoDesign / README.md
Created Jul 18, 2017
My favorite apps for developers which I use on my "Mac"
View README.md

My favorite apps for developers which I use on my "Mac"

Yep,i know it's pretty cliché, but I'll make a list of the favorite apps I use on my "Mac". That's right my "Mac", because I'm actually using a Hackintosh.

Productivity

@3runoDesign
3runoDesign / bookmarks.html
Created Mar 28, 2017
bookmarks 2015-2016
View bookmarks.html
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
It will be read and overwritten.
DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DL><p>
<DT><H3 ADD_DATE="1483280883" LAST_MODIFIED="1490426576" PERSONAL_TOOLBAR_FOLDER="true">Bookmarks Bar</H3>
<DL><p>
You can’t perform that action at this time.