Skip to content

Instantly share code, notes, and snippets.

View vinicius73's full-sized avatar
🤓
"Those who cannot acknowledge themselves, will eventually fail."

Vinicius Reis vinicius73

🤓
"Those who cannot acknowledge themselves, will eventually fail."
View GitHub Profile
@vinicius73
vinicius73 / ci.php
Created August 27, 2012 14:41
Integração Codeigniter com NetBeans
<?php
/**
* @property CI_DB_active_record $db
* @property CI_DB_forge $dbforge
* @property CI_Benchmark $benchmark
* @property CI_Calendar $calendar
* @property CI_Cart $cart
* @property CI_Config $config
* @property CI_Controller $controller
@vinicius73
vinicius73 / Bcrypt.php
Created October 3, 2012 15:09
Bcrypt Plus - Agora com criação de senha altomatica
<?php
/**
* Bcrypt hashing class
*
* @author Thiago Belem <contato@thiagobelem.net>
* @author Luiz Vinicius <contato@luizvinicius.com.br
* @link https://gist.github.com/3438461
*/
class Bcrypt {
@vinicius73
vinicius73 / gist:5415021
Created April 18, 2013 18:21
passando dados do php para javascript via atributos data-*
<!-- Link ou elemento html, adicione os elementos data-* onde quiser -->
<a class="link_ajaz_modal_box" data-url='http://minha_url_ajax_feita_pelo_php.com/conteudo/ajax' href="#">Link Ajax</a>
<script>
//recupere tudo usando $.data do jquery
$('.link_ajaz_modal_box').click(function(){
var URL = $(this).data('url'); //aqui eu pelo o elemento data-url
$('#elemento').load(URL);
});
</script>
body{
background: #e7e8e9; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2U3ZThlOSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjIwJSIgc3RvcC1jb2xvcj0iI2U3ZThlOSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjM0JSIgc3RvcC1jb2xvcj0iI2VmZjBmMCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjYxJSIgc3RvcC1jb2xvcj0iI2Y5ZmFmYSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNmZmZmZmYiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVk
@vinicius73
vinicius73 / main.js
Created June 10, 2013 15:08
Base de js para projetos
$(document).ready(function () {
SiteHome.init();
SiteCommons.init();
});
/**
* Grid gererator da homepage
* @type {{init: Function, run: Function}}
*/
var SiteHome = {
<form>
<div class="btn-group" data-toggle-name="is_private" data-toggle="buttons-radio" >
<button type="button" value="0" class="btn" data-toggle="button">Public</button>
<button type="button" value="1" class="btn" data-toggle="button">Private</button>
</div>
<input type="hidden" name="is_private" value="0" />
</form>
@vinicius73
vinicius73 / cache.php
Created February 27, 2014 14:07
Load relations com cache Laravel
<?php
$query = MyModel::orderBy('name', 'ASC');
//Sem cache
$query->with('relation1','relation2');
//Com Cache
$query->with(
[
@vinicius73
vinicius73 / base64url.php
Created March 17, 2014 15:12
Encripta dados para serem usados em urls
<?php
function base64url_encode($data) {
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
function base64url_decode($data) {
return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT));
}
@vinicius73
vinicius73 / CategoryRepository.php
Created March 25, 2014 21:06
Modelo de Repository [LARAVEL]
<?php
namespace MyApp\Repository;
use MyApp\Category;
class CategoryRepository
{
/**
* @return \Illuminate\Database\Eloquent\Collection|static[]
@vinicius73
vinicius73 / gist:9892161
Created March 31, 2014 13:24
Shortcodes para Emmet

#wordpress sidebar widget

section.widget>(header>h2)+div.inner-widget
section.widget>(header>h2)+div.inner-widget+footer