Rule | Namespace | Description |
---|---|---|
Arrays.ArrayBracketSpacing | /Squiz.Arrays.ArrayBracketSpacing | Ensure that there are no spaces around square brackets. |
Arrays.ArrayDeclaration | /Squiz.Arrays.ArrayDeclaration | Ensures that arrays conform to the array coding standard. |
Arrays.DisallowLongArraySyntax | /Generic.Arrays.DisallowLongArraySyntax | Bans the use of the PHP long array syntax. |
Arrays.DisallowShortArraySyntax | /Generic.Arrays.DisallowShortArraySyntax | Bans the use of the PHP short array syntax. |
CSS.BrowserSpecificStyles | /MySource.CSS.BrowserSpecificStyles | Ensure that browser-specific styles are not used. |
CSS.ClassDefinitionClosingBraceSpace | /Squiz.CSS.ClassDefinitionClosingBraceSpace | Ensure there is a single blank line after the closing brace of a class definition. |
CSS.ClassDefinitionNameSpacing | /Squiz.CSS.ClassDefinitionNameSpacing | Ensure there are no blank lines between the names of classes/IDs. |
CSS.ClassDefinitionOpeningBrace |
wget --no-check-certificate --content-disposition https://github.com/joyent/node/tarball/v0.7.1 | |
# --no-check-cerftificate was necessary for me to have wget not puke about https | |
curl -LJO https://github.com/joyent/node/tarball/v0.7.1 |
SSHPass is a tiny utility, which allows you to provide the ssh password without using the prompt. This will very helpful for scripting. SSHPass is not good to use in multi-user environment. If you use SSHPass on your development machine, it don't do anything evil.
apt-get install sshpass
function slugify(text) | |
{ | |
return text.toString().toLowerCase() | |
.replace(/\s+/g, '-') // Replace spaces with - | |
.replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
.replace(/\-\-+/g, '-') // Replace multiple - with single - | |
.replace(/^-+/, '') // Trim - from start of text | |
.replace(/-+$/, ''); // Trim - from end of text | |
} |
#!/usr/bin/env python | |
""" | |
mocking requests calls | |
""" | |
import mock | |
import unittest | |
import requests | |
from requests.exceptions import HTTPError |
Lately, I've been building a Python platform that relies heavily on interactions with Github. Instead of re-inventing the wheel, I decided to go with PyGithub as a wrapper around Github v3 API.
This library implements the full API, which allows me to be very productive when I need to add a workflow in my platform that involves Github. However, it quickly became a real PITA to write unit tests. Even if the package comes with its own testing Framework, it is not documented yet and I didn't manage to crack it up in a decent amount of time.
I decided to hack the testing a little bit, using another very cool package, httpretty. Httpretty allows you to monkey patch the socket module during testing, so you can respond anything you want to any kind of network requests. Here's what I came up with, do not hesitate to give any feedback.
:global wanInterface "wan1" | |
:global wanIP "$wanIP" | |
# Get the current IP on the interface | |
:local currentIPtemp [/ip address get [find interface="$wanInterface" disabled=no] address]; | |
# IP without netmask | |
:local currentIP [:pick $currentIPtemp 0 ([:len $currentIPtemp]-3)]; | |
:if ($currentIP != $wanIP) do={ |
Because Travis CI can automatically execute scripts after successfully (or unsuccessfully!) executing tests, it is an obvious choice for a deployment tool. In order to deploy to a Git repository on a remote server, the process generally is as follows:
- Set up SSH keys
- Add the server's copy of the repository as a Git remote
- Push to the remote
- SSH into the server and execute any installation/compilation/miscellaneous commands
<?php | |
namespace App\Http\Middleware; | |
use Closure; | |
use \Illuminate\Support\Facades\Redirect; | |
class LowercaseRoutes | |
{ | |
/** |
#!/bin/bash | |
go test -coverprofile=coverage.out | |
go tool cover -html=coverage.out |