Skip to content

Instantly share code, notes, and snippets.

<?php
//error_reporting(E_ERROR);
$original = imagecreatefrompng("assets/picture.png");
$mask = imagecreatefrompng("assets/mask.png");
$masked = applyAlphaMask( $original, $mask );
function applyAlphaMask($image, $mask) {
/**
* Very simple way to check if a file exists on this domain.
* Use with the jQuery library.
*
* Important: Works only on the same domain.
* Cross-domain-requests have to be done in another way (see JSONP)!
*
* Use: console.log( "/data/list.json".fileExists() );
*/
String.prototype.fileExists = function() {
/*
* This Class serializeTo
* Return dataserialize object, array or string
* @author Gustavo da Silva Rodrigues <[email protected]>
*/
;(function ( $, window, document, undefined ) {
var pluginName = "serializeTo",
/**
* default Configuration
/**
* Referências caso necessário
* http://copacocacola.terra.com.br/infografico/dribles/info-dribles/js/info.js
*/
var facebook = (function() {
var share =function(data, type) {
type = type ? type : 'feed';
FB.ui({
#!/usr/bin/env bash
# Use this one-liner to produce a JSON literal from the Git log:
git log \
--pretty=format:'{%n "commit": "%H",%n "author": "%an <%ae>",%n "date": "%ad",%n "message": "%f"%n},' \
$@ | \
perl -pe 'BEGIN{print "["}; END{print "]\n"}' | \
perl -pe 's/},]/}]/'
@anderson-mota
anderson-mota / 0_reuse_code.js
Created October 21, 2015 17:24
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@anderson-mota
anderson-mota / AuthInterceptor.js
Created March 15, 2016 22:58 — forked from danjesus/AuthInterceptor.js
A simple angular interceptor
(function () {
'use strict';
angular.module('smartticket.services')
.factory('BearerAuthInterceptor', function ($window, $q, $localStorage, $location) {
return {
request: function (config) {
config.headers = config.headers || {};
@anderson-mota
anderson-mota / Install_Phpstorm.sh
Created April 23, 2016 04:40 — forked from theodorosploumis/Install_Phpstorm.sh
Update phpstorm on Ubuntu linux.
#!/bin/bash -e
# IMPORTANT. My phpstom installation exists on /opt/phpstorm.
# IMPORTANT. Run with sudo!
# Early Access program: https://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Early+Access+Program
echo -n "Please enter the PhpStorm download url (eg http://download.jetbrains.com/webide/PhpStorm-EAP-141.690.tar.gz): "
read url
# Download file from url
echo "Downloading PhpStorm to ~/Desktop"
@anderson-mota
anderson-mota / Dockerfile
Created July 4, 2018 01:05 — forked from varyonic/Dockerfile
Dockerfile with chromedriver
# See https://codeship.com/documentation/docker/browser-testing/
FROM myapp:base
# We need wget to set up the PPA and xvfb to have a virtual screen and unzip to install the Chromedriver
RUN apt-get install -y wget xvfb unzip
# Set up the Chrome PPA
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
@anderson-mota
anderson-mota / docker-install-lubuntu-17.04.sh
Created September 24, 2019 22:43 — forked from pjmazenot/docker-install-lubuntu-17.04.sh
Install Docker CE on Lubuntu 17.04
#!/bin/sh
# Install Docker CE on Lubuntu 17.04
# Run this script with sudo privileges `sudo docker-install-lubuntu-17.04.sh`
apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu zesty stable"
apt-get update
apt-get install -y docker-ce