Skip to content

Instantly share code, notes, and snippets.

View viniciusbig's full-sized avatar

Vinicius Arantes viniciusbig

  • CI&T
  • Campinas - SP - Brazil
View GitHub Profile
@viniciusbig
viniciusbig / functions.php
Created July 5, 2017 18:56 — forked from vishalbasnet23/functions.php
Create WooCommerce Subscription and activate Subscription for a user programatically.
<?php
function cpm_create_order($customer_data, $the_customer) {
global $woocommerce;
$product_id = $customer_data['sub_product'];
$variation_id = $customer_data['sub_variation'];
$user_first_name = $customer_data['first_name'];
$user_last_name = $customer_data['last_name'];
$user_email = $customer_data['user_email'];
$billing_email = $customer_data['user_email'];
$billing_state = $customer_data['cpm_state'];
#!/bin/bash
# usage: "newgit some/path"
newgit() {
### SETTINGS ###
# this is the root of all your git folders
local LOCAL_GIT_ROOT=~/web
# this is your ssh [user]@[host]
@viniciusbig
viniciusbig / gulpfile.js
Created March 29, 2018 13:55 — forked from csrui/gulpfile.js
Generic gulpfile for CakePHP apps. Compiles and minifies sass. Minifies and lints javascript. Generates documentation with yuidoc
var gulp = require('gulp');
// Include Our Plugins
var jshint = require('gulp-jshint');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var minifyCSS = require('gulp-minify-css');
var rename = require('gulp-rename');
var yuidoc = require("gulp-yuidoc");
// transform cropper dataURI output to a Blob which Dropzone accepts
function dataURItoBlob(dataURI) {
var byteString = atob(dataURI.split(',')[1]);
var ab = new ArrayBuffer(byteString.length);
var ia = new Uint8Array(ab);
for (var i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i);
}
return new Blob([ab], { type: 'image/jpeg' });
}
@viniciusbig
viniciusbig / gist:722ca4d79150a031e554a2887a8f9677
Created July 31, 2018 22:26 — forked from diegoprates/gist:5047663
Tradução do jQuery validation plugin oara pt-BR. By https://gist.github.com/FernandoVezzali.
/*
* Translated default messages for the jQuery validation plugin.
* Locale: PT_BR
*/
jQuery.extend(jQuery.validator.messages, {
required: "Este campo &eacute; requerido.",
remote: "Por favor, corrija este campo.",
email: "Por favor, forne&ccedil;a um endere&ccedil;o eletr&ocirc;nico v&aacute;lido.",
url: "Por favor, forne&ccedil;a uma URL v&aacute;lida.",
date: "Por favor, forne&ccedil;a uma data v&aacute;lida.",
@viniciusbig
viniciusbig / dreamhost-php.md
Created August 9, 2018 01:46 — forked from nissicreative/dreamhost-php.md
Update PHP and install Composer on DreamHost

DreamHost PHP

Make PHP 7 default binary for CLI

ssh <server>
@viniciusbig
viniciusbig / deploy.php
Created September 13, 2018 17:37 — forked from sakanaproductions/deploy.php
PHP Deployer Config File for VPS on Dreamhost
<?php
namespace Deployer;
require 'recipe/laravel.php';
// Project name
set('application', '');
// Project repository
set('repository', 'git@bitbucket.org');
<?php
/*
Increase or decrease value in CakePHP with little footprint.
Add this to your AppModel.
Usage:
(in Controller)
$this->Model->increase('field_name', 1);
@viniciusbig
viniciusbig / wp.sh
Created January 16, 2019 21:36 — forked from bgallagh3r/wp.sh
Wordpress: Bash Install Script -- Downloads latest WP version, updates wp-config with user supplied DB name, username and password, creates and CHMOD's uploads dir, copies all the files into the root dir you run the script from, then deletes itself!
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Database Name: "
read -e dbname
echo "Database User: "
read -e dbuser
echo "Database Password: "
@viniciusbig
viniciusbig / 80-keychron.rules
Created September 4, 2019 17:26 — forked from ercoppa/80-keychron.rules
K2 Keychron Ubuntu 18.04
SUBSYSTEMS=="input", ATTRS{name}=="Keychron K2", RUN+="/bin/sh -c 'echo 0 > /sys/module/hid_apple/parameters/fnmode'"