Skip to content

Instantly share code, notes, and snippets.

View snoek09's full-sized avatar
🐟

Henry Snoek snoek09

🐟
View GitHub Profile
<?php
public function action_save_chart() {
$string = <<<EOD
{"infile":"{credits:{enabled:false},xAxis:{categories:['Jan','Feb','Mar']},series:[{data:[29.9,71.5,106.4]}]}"}
EOD;
$ch = curl_init('http://127.0.0.1:3003');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
@snoek09
snoek09 / phpstorm.md
Last active August 29, 2015 14:03
PhpStorm

Shortcuts

  • ! Tab in template creates html skeleton
  • link Tab creates stylesheet link
  • .container Tab creates div with id=container
  • Alt-1 toggle sidebar
  • Shift-Alt-A search everything
  • Match sidebar color with color theme -> install plugin 'color ide'

Custom Keybindings

  • Begin of line - C-a
@snoek09
snoek09 / nginx.conf
Last active August 29, 2015 14:04
Extra SSL settings for Nginx
# enables server-side protection from BEAST attacks
ssl_prefer_server_ciphers on;
# disable SSLv3(enabled by default since nginx 0.8.19) since it's less secure then TLS
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
# ciphers chosen for forward secrecy and compatibility
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK';
# config to enable HSTS(HTTP Strict Transport Security) https://developer.mozilla.org/en-US/docs/Security/HTTP_Strict_Transport_Security
@snoek09
snoek09 / soapClient.php
Last active August 29, 2015 14:06
SOAP Client test call, using Charles Proxy to debug
<?php
$options = array(
"cache_wsdl" => WSDL_CACHE_NONE,
"soap_version" => SOAP_1_1,
"trace" => 1,
"proxy_host" => "localhost",
"proxy_port" => 8888,
);
@snoek09
snoek09 / get_pull_request_from_deleted_fork.rst
Last active August 29, 2015 14:23
Get pull request from deleted fork

git remote add upstream https://github.com/symfony/symfony-docs.git

Edit .git/config

In upstream block add fetch = +refs/pull/*/head:refs/remotes/upstream/pr/*

git fetch upstream

git merge upstream/pr/5285

@snoek09
snoek09 / mailcatcher-setup-symfony-vagrant.md
Last active January 11, 2018 13:49
mailcatcher setup with symfony running in vagrant box

Forward port 1080 in Vagrantfile

config.vm.network :forwarded_port, host: 1080, guest: 1080

Install mailcatcher on vagrant box

sudo apt-get install ruby-dev
sudo apt-get install libsqlite3-dev
sudo gem install mailcatcher
@snoek09
snoek09 / get_line_content_from_file.sh
Last active January 7, 2016 12:40
Bash script to use a file with line numbers to get the content from those lines from another file
#!/bin/bash
# Usage get_line_content_from_file.sh file_containing_linenumbers_only file
while IFS='' read -r line || [[ -n "$line" ]]; do
awk '{ if(NR==n) print $0 }' n=$line $2
done < "$1"
@snoek09
snoek09 / gist:19e1dbdda1318b4a9570543b299450d7
Created November 13, 2016 14:23
get remote pull request
git remote add upstream https://github.com/symfony/symfony-docs.git
nano .git/config
# in upstream block add
fetch = +refs/pull/*/head:refs/remotes/upstream/pr/*
git fetch upstream
git merge upstream/pr/5285
@snoek09
snoek09 / xhprof_php7.md
Last active July 13, 2017 08:43
install XHProf fork (Tideways) on Ubuntu

all instructions for php 7.0

install XHProf fork (Tideways) on ubuntu

$ sudo nano  /etc/apt/sources.list.d/tideways.list

deb http://s3-eu-west-1.amazonaws.com/qafoo-profiler/packages debian main

$ wget -qO - https://s3-eu-west-1.amazonaws.com/qafoo-profiler/packages/EEB5E8F4.gpg | sudo apt-key add -

$ sudo apt-get update

@snoek09
snoek09 / soapClientNonWsdl.php
Last active April 22, 2020 15:09
In case you need to connect to a soap service without WSDL
<?php
$client = new SoapClient(
null,
[
'location' => 'http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso',
'uri' => 'http://www.oorsprong.org/websamples.countryinfo',
]
);