Skip to content

Instantly share code, notes, and snippets.

View graciano's full-sized avatar

Graciano graciano

View GitHub Profile
@graciano
graciano / baseConverter.js
Last active November 6, 2015 14:04 — forked from faisalman/baseConverter.js
Convert From/To Binary/Decimal/Hexadecimal in JavaScript
/**
* Conver From/To Binary/Decimal/Hexadecimal in JavaScript
* Matheus Graciano <graciano.dev@gmail>, Lucas Gonzalez <lucasmgonzalez1992@gmail.com>
*
* Adapted from
* https://gist.github.com/faisalman/4213592
*
* Copyright 2012-2015, Faisalman <fyzlman@gmail.com>
* Licensed under The MIT License
* http://www.opensource.org/licenses/mit-license
@graciano
graciano / DatabaseSeeder.php
Created March 15, 2016 20:00
Create random users in laravel for test in facebook graph api using faker
<?php
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
var sendAjaxFormLaravel = function(form, callbacks){
var formAction = form.attr('action');
var formMethod = form.attr('method');
var formData;
if(formMethod.toLowerCase() == 'post'){
formData = form.serializeArray();
$.ajaxSetup({
headers: { 'X-CSRF-Token' : $('meta[name=_token]').attr('content') }
});
}
@graciano
graciano / Preference.sublime-settings
Last active February 13, 2017 17:35
preferences for sublime text 2
{
"close_windows_when_empty": false,
"color_scheme": "Packages/Theme - Brogrammer/brogrammer.tmTheme",
"line_padding_top" : 5,
"line_padding_bottom" : 5,
"file_exclude_patterns":
[
"*.pyc",
"*.rpyc",
"*.pyo",
@graciano
graciano / README.md
Last active May 31, 2017 15:39 — forked from NandoSangenetto/README.me
Compress and convert images

Convert images to webp from folder

Installation

You need to download libwebp and put in the shell script folder. You must have installed the jpegoptim, giflossy (gifsicle), pngquant and imagemagick library.

Usage

  • Convert folder and put results in the results folder:
@graciano
graciano / addResizeEventBreakpoint.js
Last active June 6, 2017 17:53
addResizeEventBreakpoint.js Add given screen specific callbacks to run when resize changes from 768px breakpoint. Ensures that one of the callbacks run right after calling it
/**
* Add given screen specific callbacks to run when resize changes from 768px breakpoint
* Ensures that one of the callbacks run at the end of this function
*/
let addResizeEventBreakpoint = function(mobileCallback, desktopCallback) {
// force handleResize to run some callback at first
var mobileState = window.matchMedia("(min-width: 768px)").matches;
function handleResize() {
//run mobileCallback if resized to mobile and last function that ran was desktopCallback
/*
* this really needs more work, the translates are tested only with 25px
*/
@mixin arrow($size: 25px, $orientation: left, $color: #000, $hover-color: red) {
&:before, &:after {
display: block;
width: $size;
height: 1em;
border-top: 3px solid $color;
line-height: 1em;
{
init: function(elevators, floors) {
for (let floor of floors) {
floor.on("up_button_pressed", function() {
for(let elevator of elevators) {
elevator.checkDestinationQueue();
if(elevator.destinationQueue.lenght > 0 && elevator.loadFactor == 1){
elevator.destinationQueue.push(floor);
elevator.checkDestinationQueue();
}
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name='keywords' content="is, this, still, useful?">
<meta name='description' content="This is a quick html5 stuff gist">
<link rel="profile" href="http://graciano.github.io" />
<meta property="og:image" content="imagens/dev.svg">
<meta property="og:title" content="html5 gist">
@graciano
graciano / amp_post.php
Last active June 12, 2020 19:03
wordpress AMP plugin using amp.example.com subdomain
<!doctype html>
<html amp="" lang="pt-br">
<head>
<meta charset="utf-8" />
<title><?php echo $this->get( 'document_title' ) ?></title>
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<?php do_action( 'amp_post_template_head', $this ); ?>