Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / .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 / 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 / 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 / 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 / soapclient.php
Last active June 26, 2016 00:37
An Example of PHP SoapClient
<?php
// Nota: O ideal é que esse script fique em outro arquivo para
// não misturar regras de negócio com o HTML ...
$wsdl = "http://ws.registrocivil.org.br/listarCartoriosReceitaFederal.cfc?wsdl";
try {
$options = array(
'soap_version' => SOAP_1_1,
@jpcercal
jpcercal / gist:72007391b4cdc67ad3e4
Created July 6, 2015 12:32
Composer PostInstallCmd
#!/usr/bin/env bash
BASE_PROJECT_DIR=`pwd`
rm $BASE_PROJECT_DIR/.git/hooks/pre-commit 2> /dev/null
ln -s $BASE_PROJECT_DIR/bin/git/hooks/pre-commit $BASE_PROJECT_DIR/.git/hooks/pre-commit
chmod +x $BASE_PROJECT_DIR/.git/hooks/pre-commit
#!/usr/bin/env bash
DATE_FORMAT="+%Y-%m-%d %H:%M:%S"
echo "["$(date "$DATE_FORMAT")"] Running PHPCSFixer ..."
COMMAND_GIT_DIFF="git diff --cached --name-status --diff-filter=ACM"
COMMAND_PHP_CS_FIXER="./vendor/fabpot/php-cs-fixer/php-cs-fixer fix --dry-run --level=psr2 --verbose"
PHP_FILES_TO_BE_COMMITED=`$COMMAND_GIT_DIFF | grep -E -o '\W+.*?\.php'`
@jpcercal
jpcercal / git-show-content-file-of-a-specific-commit
Created June 1, 2015 13:56
Git Show Content File of a Specific Commit
# git show 0a6cba589532c1b8079e10d9f16511a0d3cd8961:src/filename.ext
git show <treeish>:<file>
# or
git show HEAD~1:src/filename.ext