Skip to content

Instantly share code, notes, and snippets.

View nietzscheson's full-sized avatar

Cristian Angulo nietzscheson

View GitHub Profile
@nietzscheson
nietzscheson / install.sh
Created September 6, 2017 16:22 — forked from ziadoz/install.sh
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`
@nietzscheson
nietzscheson / Install-php7.md
Created December 22, 2016 16:03 — forked from hollodotme/Install-php7.md
Installing php7-fpm with phpredis and xdebug extension on Ubuntu 14.04

Install php7.0-fpm

# remove php5 modules
apt-get autoremove --purge php5-*
# add php-7.0 source list by [Ondřej Surý](https://github.com/oerdnj)
add-apt-repository ppa:ondrej/php
# Update index
apt-get update
# Install php7.0-fpm with needed extensions
@nietzscheson
nietzscheson / gist:a31f001f0bbc08bc07dbe9ae85c7e268
Created October 10, 2016 15:11 — forked from Steven-Rose/gist:3943830
VI: Select all + delete, select all + copy
Select all and delete (actually move to buffer)
:%d
Select all and copy to buffer
:%y
Use p to paste the buffer.
@nietzscheson
nietzscheson / README.md
Created August 31, 2016 14:17 — forked from joyrexus/README.md
form-data vs -urlencoded

Nice answer on stackoverflow to the question of when to use one or the other content-types for POSTing data, viz. application/x-www-form-urlencoded and multipart/form-data.

“The moral of the story is, if you have binary (non-alphanumeric) data (or a significantly sized payload) to transmit, use multipart/form-data. Otherwise, use application/x-www-form-urlencoded.”


Matt Bridges' answer in full:

The MIME types you mention are the two Content-Type headers for HTTP POST requests that user-agents (browsers) must support. The purpose of both of those types of requests is to send a list of name/value pairs to the server. Depending on the type and amount of data being transmitted, one of the methods will be more efficient than the other. To understand why, you have to look at what each is doing

<?php
class Logger
{
protected $file;
public function __construct($file) { $this->file = $file; }
public function log($message)
{
$message = date('H:i:s ') . $message . PHP_EOL;
@nietzscheson
nietzscheson / bs3-login-form.html
Created August 6, 2016 19:18 — forked from bMinaise/bs3-login-form.html
Bootstrap 3 - Login Form Example From: http://bootsnipp.com
<div class="container">
<div class="row">
<div class="col-sm-6 col-md-4 col-md-offset-4">
<h1 class="text-center login-title">Sign in to continue to Bootsnipp</h1>
<div class="account-wall">
<img class="profile-img" src="https://lh5.googleusercontent.com/-b0-k99FZlyE/AAAAAAAAAAI/AAAAAAAAAAA/eu7opA4byxI/photo.jpg?sz=120"
alt="">
<form class="form-signin">
<input type="text" class="form-control" placeholder="Email" required autofocus>
<input type="password" class="form-control" placeholder="Password" required>
@nietzscheson
nietzscheson / README.md
Created July 13, 2016 21:51 — forked from tjamps/README.md
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

The API we are creating in this gist will follow these rules :

  • The API only returns JSON responses
  • All API routes require authentication
  • Authentication is handled via OAuth2 with password Grant Type only (no need for Authorization pages and such).
  • API versioning is managed via a subdomain (e.g. v1.api.example.com)

The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :

@nietzscheson
nietzscheson / http_status_codes.php
Created July 5, 2016 22:34 — forked from gibbs/http_status_codes.php
HTTP status codes array
<?php
$code = array();
$code['0'] = 'Connection Failed. Please configure Varnish to accept HTTP purge requests.';
$code['100'] = 'Continue';
$code['101'] = 'Switching Protocols';
$code['102'] = 'Processing';
$code['200'] = 'OK';
$code['201'] = 'Created';
$code['202'] = 'Accepted';
@nietzscheson
nietzscheson / currency_symbols.php
Created July 5, 2016 22:33 — forked from gibbs/currency_symbols.php
An array of currency symbols as HTML entities
<?php
$currency_symbols = array(
'AED' => '&#1583;.&#1573;', // ?
'AFN' => '&#65;&#102;',
'ALL' => '&#76;&#101;&#107;',
'AMD' => '',
'ANG' => '&#402;',
'AOA' => '&#75;&#122;', // ?
'ARS' => '&#36;',
'AUD' => '&#36;',
@nietzscheson
nietzscheson / gulpfile.js
Created March 23, 2016 00:26 — forked from kurtisdunn/gulpfile.js
Gulp Config for Drupal 8, Drush, SASS & BrowserSync.
/rest//*global -$ */
'use strict';
var gulp = require('gulp');
var sass = require('gulp-sass');
var mainBowerFiles = require('main-bower-files');
var $ = require('gulp-load-plugins')();
var browserSync = require('browser-sync');
var reload = browserSync.reload;
// Error notifications