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 | |
namespace App\Services\Rest; | |
use Illuminate\Contracts\Support\Jsonable; | |
use Illuminate\Contracts\Support\Arrayable; | |
class Message implements Jsonable, Arrayable | |
{ |
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
docker build -t image-name . | |
docker run -d -p 80:80 -p 3306:3306 image-name | |
docker exec -it ff14156cb37b bash | |
docker rm -f $(docker ps -a -q) | |
docker rmi $(docker images -q) |
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
/* | |
* Copyright 2012-2013 (c) Pierre Duquesne <[email protected]> | |
* Licensed under the New BSD License. | |
* https://github.com/stackp/promisejs | |
*/ | |
(function(a){function b(){this._callbacks=[];}b.prototype.then=function(a,c){var d;if(this._isdone)d=a.apply(c,this.result);else{d=new b();this._callbacks.push(function(){var b=a.apply(c,arguments);if(b&&typeof b.then==='function')b.then(d.done,d);});}return d;};b.prototype.done=function(){this.result=arguments;this._isdone=true;for(var a=0;a<this._callbacks.length;a++)this._callbacks[a].apply(null,arguments);this._callbacks=[];};function c(a){var c=new b();var d=[];if(!a||!a.length){c.done(d);return c;}var e=0;var f=a.length;function g(a){return function(){e+=1;d[a]=Array.prototype.slice.cindex(arguments);if(e===f)c.done(d);};}for(var h=0;h<f;h++)a[h].then(g(h));return c;}function d(a,c){var e=new b();if(a.length===0)e.done.apply(e,c);else a[0].apply(null,c).then(function(){a.splice(0,1);d(a,arguments).then(function(){e.done.apply(e,arguments);});});return e;}f |
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
func TodayDate() time.Time { | |
sp, err := time.LoadLocation("America/Sao_Paulo") | |
if err != nil { | |
panic(err) | |
} | |
now := time.Now().In(sp) | |
year, month, day := now.Date() | |
return time.Date(year, month, day, 0, 0, 0, 0, now.Location()) | |
} |
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
# remove from git and commit | |
git rm -r dir1/ dir2/ file.1 | |
git commit -m 'remmove stuff' | |
# remove from branch history | |
git filter-branch --index-filter \ | |
'git rm -r --ignore-unmatch --cached dir1/ dir2 file.1' -- 7b30847^.. # last commit BEFORE removing stuff | |
# remove from filesystem | |
rm -rf dir1/ dir2/ file.1 |
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
angular.module('app.resources', ['ngResource']) | |
.factory('api', function ($resource) { | |
var api = { | |
defaultConfig : {id: '@id'}, | |
extraMethods: { | |
'update' : { | |
method: 'PUT' | |
} |
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
/* | |
* Copyright 2012-2013 (c) Pierre Duquesne <[email protected]> | |
* Licensed under the New BSD License. | |
* https://github.com/stackp/promisejs | |
*/ | |
(function(exports) { | |
function Promise() { | |
this._callbacks = []; |
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
<?xml version="1.0"?> | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:strip-space elements="*"/> | |
<xsl:output method="text"/> | |
<xsl:template match="/"> | |
<xsl:apply-templates select="mysqldump/database"/> | |
</xsl:template> |
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
import sys | |
from PIL import Image | |
from PIL import ImageFont | |
from PIL import ImageDraw | |
''' | |
==== Dependências ==== | |
instalar PIL: | |
sudo apt-get install python-pil |
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 | |
// Na pasta /encoding há um arquivo Encoding.php com a classe Encoding | |
// incluir se não estiver (prestar atenção no caminho) | |
class_exists('Encoding') || require(dirname(__FILE__) . '/../encoding/Encoding.php'); | |
// converter para Latin-1 | |
$minhaStringQuebrada = 'Não çei'; | |
echo Encoding::toLatin1($minhaStringQuebrada)); |
NewerOlder