Skip to content

Instantly share code, notes, and snippets.

View cjaoude's full-sized avatar

cjaoude

View GitHub Profile
@cjaoude
cjaoude / htaccess_gists.txt
Last active August 29, 2015 13:56
Hide .git files and folders with .htaccess
RedirectMatch 404 "(?:.*)/(?:\.git|file_or_dir)(?:/.*)?$"
// 'cuz the last thing anyone should need is to learn tar
// the trick to tar is, the -f flag needs to be the last option enumerated
// compress and archive folder | file
tar -zcf archive_name.tar.gz directory/file
// decompress archive
tar -zxf file.tar.gz
@cjaoude
cjaoude / delete custom macro
Last active January 7, 2016 22:02
Laravel Form custom delete macro
// Create a 'delete' form in a single line. This Laravel form macro is a shortcut that
// creates a form with a DELETE method and a 'Delete' button. This macro saves you
// the trouble of creating a form each time you need to make a delete route.
// Place this code in a app/macros.php file and require this file in global.php
// ref: http://laravel.com/docs/html#custom-macros
Form::macro('delete', function($options){
$open = Form::open([
'route' => [ $options['route'], $options['id'] ],
@cjaoude
cjaoude / laravel-all-resource-routes
Last active August 29, 2015 14:04
All resource routes by action, with route names. (Laravel)
Route::get('resource', [ 'uses' => 'Controller@index', 'as' => 'resource.index']);
Route::get('resource/create', [ 'uses' => 'Controller@create' , 'as' => 'resource.create']);
Route::post('resource', [ 'uses' => 'Controller@store', 'as' => 'resource.store']);
Route::get('resource/{resource}', [ 'uses' => 'Controller@show' , 'as' => 'resource.show']);
Route::get('resource/{resource}/edit', [ 'uses' => 'Controller@edit' , 'as' => 'resource.edit']);
@cjaoude
cjaoude / snippet-laravel-all-routes
Created July 22, 2014 04:01
All resource routes by action, with route names. (Laravel Snippet)
<snippet>
<content><![CDATA[
Route::get('${1:resource}', [ 'uses' => '${3:Controller}@index', 'as' => '${1:resource}.index']);
Route::get('${1:resource}/create', [ 'uses' => '${3:Controller}@create' , 'as' => '${1:resource}.create']);
Route::post('${1:resource}', [ 'uses' => '${3:Controller}@store', 'as' => '${1:resource}.store']);
Route::get('${1:resource}/{${2:resource}}', [ 'uses' => '${3:Controller}@show' , 'as' => '${1:resource}.show']);
@cjaoude
cjaoude / gist:fd9910626629b53c4d25
Last active November 14, 2024 02:17
Test list of Valid and Invalid Email addresses
Use: for testing against email regex
ref: http://codefool.tumblr.com/post/15288874550/list-of-valid-and-invalid-email-addresses
List of Valid Email Addresses
email@example.com
firstname.lastname@example.com
email@subdomain.example.com
firstname+lastname@example.com
@cjaoude
cjaoude / chmod-tutorial.md
Last active May 7, 2024 11:58
chmod tutorial / cheat sheet / cheatsheet / for dummies

chmod
Forget the chmod octals (the numbers). Set permission the easy way using the keywords

// know the ownerships:
u = User (you)
g = Group
o = Other (aka. 'World')
a = All of the above

@cjaoude
cjaoude / bash notes.md
Created January 30, 2017 15:58
Bash, made easy:

Run commands, by condition:

A; B    Run A and then B, regardless of success of A
A && B  Run B if A succeeded
A || B  Run B if A failed
A &     Run A in background.
@cjaoude
cjaoude / SanityTable.vue
Created November 10, 2019 19:18
selectable + transitions bootstrap-vue table
<template>
<div>
<b-table
id="table-transition-example"
:items="items"
:fields="fields"
striped
small
primary-key="a"
selectable