Skip to content

Instantly share code, notes, and snippets.

@anderson-mota
anderson-mota / git-rename-branch.sh
Created February 1, 2018 15:21
Git rename remote branch
# rename the local branch to the new name
git branch -m old_name new_name
# delete the old branch on remote - where <remote> is eg. origin
git push <remote> --delete old_name
# push the new branch to remote
git push <remote> new_name
@anderson-mota
anderson-mota / auto_incremento.sql
Last active November 15, 2017 20:53
PostgresSQL
SELECT nextval('releases_id_seq'::regclass);

I occasionally need the list of method parameter matchers when setting assertions via mocks using with(). A completely useless example:

$foo->expects($this->once())
    ->method('setter')
    ->with($this->isType('string'));

I can see a few documented in the examples but the most conclusive list I’ve come across is from slide 11 of these Advanced PHPUnit Testing slides. So I am posting them here, if only for my own use:

<!DOCTYPE html>
<html>
<head>
<title>Teste de parametros</title>
<style type="text/css">
.with-black-firday {display:none;}
</style>
</head>
<body>
@anderson-mota
anderson-mota / RenameFilesInFolder.php
Created September 6, 2016 18:48
Rename files in directory.
$files = glob(public_path('images/highlights/svg/*'));
foreach($files as $file) {
$fileInfo = pathinfo($file);
$renameTo = str_slug($fileInfo['filename']);
rename($file, $fileInfo['dirname'] . '/' . $renameTo . '.' . $fileInfo['extension']);
echo $fileInfo['dirname'] . '/' . $renameTo . '.' . $fileInfo['extension'] . '<br>';
var gulp = require('gulp'),
uglify = require('gulp-uglify'),
cssmin = require('gulp-cssmin'),
importcss = require('gulp-import-css'),
concat = require('gulp-concat'),
include = require('gulp-include'),
compass = require('gulp-compass'),
rename = require('gulp-rename'),
livereload = require('gulp-livereload');
class Article extends Model
{
protected $fillable = ['title', 'slug', 'content', 'excerpt', 'tags', 'image', 'template', 'seo_title', 'seo_description', 'status'];
protected $casts = ['status' => 'boolean'];
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function categories()
'use strict';
angular.module('cms', [
'ngRoute'
])
.constant('API', {
"route": function(name) {
return '/admin/api/'+name;
}
})
@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"