This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//error_reporting(E_ERROR); | |
$original = imagecreatefrompng("assets/picture.png"); | |
$mask = imagecreatefrompng("assets/mask.png"); | |
$masked = applyAlphaMask( $original, $mask ); | |
function applyAlphaMask($image, $mask) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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/},]/}]/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
'use strict'; | |
angular.module('smartticket.services') | |
.factory('BearerAuthInterceptor', function ($window, $q, $localStorage, $location) { | |
return { | |
request: function (config) { | |
config.headers = config.headers || {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
OlderNewer