Skip to content

Instantly share code, notes, and snippets.

@jpcercal
jpcercal / ngModelDirective.js
Created February 5, 2016 19:40
How to Fix the problem with the AngularJS + MDL thats not fire the event input when data is loaded using a external resource with $http ou $resource
(function() {
var yourModuleName = angular.module("modules.yourModuleName");
yourModuleName.directive('ngModel', function() {
return {
restrict: 'A',
priority: -1,
link: function(scope, element, attr) {
@jpcercal
jpcercal / export_google_music.js
Created March 17, 2016 19:13 — forked from jmiserez/export_google_music.js
Export your Google Music Library and Playlists (Google Play Music All Access) (see http://webapps.stackexchange.com/questions/50311/print-playlist-from-google-play-music for more)
// Jeremie Miserez <[email protected]>, 2015
//
// A little bit of Javascript to let you export your Google Music library, playlists, and album track lists :)
//
// I posted this as an answer here: http://webapps.stackexchange.com/questions/50311/print-playlist-from-google-play-music
//
// 1. Go to: https://play.google.com/music/listen#/all (or your playlist)
//
// 2. Open a developer console (F12 for Chrome). Paste
// code below into the console.
@jpcercal
jpcercal / export_groove_music_playlist.js
Last active March 30, 2016 18:43
Export Goove Music (Microsoft)
/**
* Open your playlist and put the code on console (tested with Google Chrome),
* your songs will be printed on your Console too.
*
* @author João Paulo Cercal <[email protected]>
*/
var data = [];
$('.mediaRow').each(function(index, elem) {
@jpcercal
jpcercal / .htaccess
Created June 8, 2016 13:15 — forked from thoop/.htaccess
Official prerender.io .htaccess for Apache.
# Change YOUR_TOKEN to your prerender token and uncomment that line if you want to cache urls and view crawl stats
# Change http://example.com (at the end of the last RewriteRule) to your website url
<IfModule mod_headers.c>
#RequestHeader set X-Prerender-Token "YOUR_TOKEN"
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
@jpcercal
jpcercal / Gruntfile.js
Created August 19, 2016 20:53
Gruntfile.js
module.exports = function(grunt) {
'use strict';
grunt.initConfig({
ngAnnotate: {
options: {
singleQuotes: true
},
production: {
files: [
@jpcercal
jpcercal / SweetAlert.js
Last active October 21, 2016 16:57
A angular service to use the sweetalert library.
(function () {
'use strict';
angular
.module('yourApp')
.factory('SweetAlert', SweetAlert);
/* @ngInject */
function SweetAlert($http, $interpolate, $rootScope) {
@jpcercal
jpcercal / download-patches.sh
Created November 7, 2016 17:23 — forked from mzeis/download-patches.sh
Download Magento CE security patches SUPEE-1533 ad SUPEE-8788 v2 using bash. Open the file for usage information.
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# Author: Matthias Zeis (https://github.com/mzeis, https://twitter.com/mzeis)
# Date: 2016/10/17
# Version: 1.0
# License: MIT (https://en.wikipedia.org/wiki/MIT_License)
#
@jpcercal
jpcercal / article.md
Created April 26, 2017 21:30
Article

How do you get your environment variables using PHP?

You probably get your environment variables using built-in PHP functions such as getenv or $_ENV, but did you know that you can do it in an elegant way getting the value of an environment variable in the properly PHP data type with the powerful library? If you are curious, just read how this energetic library can help you in your daily development workflow.

Note that in this article we'll use a famous library to load environment variables from an external file, this library is vlucas/phpdotenv.

Then, firstly, you need to install the dependencies. To do it, simply type this in your terminal:

$ composer require vlucas/phpdotenv
resume:
name: João Paulo Cercal
job:
en: Senior Software Engineer
pt_BR: Engenheiro de Software Sênior
de_DE: Softwareentwickler
location:
en: Munich, Germany
pt_BR: Munique, Alemanha
de_DE: München, Deutschland
@jpcercal
jpcercal / osx-for-hackers.sh
Created November 14, 2017 17:37 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx