Skip to content

Instantly share code, notes, and snippets.

@mikesmullin
mikesmullin / chromedriver.sh
Created May 8, 2012 16:08
easily install chromedriver on linux/osx
sudo apt-get install unzip;
wget -O /tmp/chromedriver.zip http://chromedriver.googlecode.com/files/chromedriver_linux64_19.0.1068.0.zip && sudo unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/;
@yratof
yratof / gist:5851424
Created June 24, 2013 16:32
Wordpress loop to list posts by day of the week
<?php //This gets the current month starting at day 1, and the next month starting at day 1
$now = mktime(0, 0, 0, date("m"), 1, date('Y'));
$then = mktime(0, 0, 0, (date("m") % 12 + 1), 1, date('Y'));
query_posts(
array(
'post_type' => 'classes', // Custom Post Type
'order' => 'asc', // Order with earliest first
'orderby' => 'wpcf-date-and-time', // Order by the custom field
'posts_per_page' => -1, // Show all
@plentz
plentz / nginx.conf
Last active July 15, 2024 17:46
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@derak-kilgo
derak-kilgo / customer-export.php
Last active April 17, 2021 01:11
CLI php script to export customers from magento to CSV using direct access to a magento collection.
<?php
if(php_sapi_name()!=="cli"){
echo "Must be run from the commend line.";
};
/**
* Setup a magento instance so we can run this export from the command line.
*/
require_once('app/Mage.php');
umask(0);
if (!Mage::isInstalled()) {
@fprochazka
fprochazka / composer.php.ini
Last active June 14, 2022 15:09
Composer with different ini or with different PHP
[php]
memory_limit = -1
max_execution_time = 0
date.timezone = "Europe/Prague"
realpath_cache_size = "4096K"
[opcache]
opcache.enable = 1
opcache.enable_cli = 1
opcache.memory_consumption = 256
@jakubzitny
jakubzitny / snippets
Last active January 19, 2024 10:06
StackOverflow JS <code> snipptes - filtered, unescaped
// SNIPPET:
e.preventDefault()
// SNIPPET:
onclick='document.formName.submit();'
@jmn
jmn / gist:4de857259b1dfc54ab80b5682af935ad
Last active July 13, 2021 03:12
Building h2load (of nghttp2) on Ubuntu 16.04
#! /bin/bash
# https://nghttp2.org/documentation/h2load-howto.html
sudo apt-get update
sudo apt-get install g++ make binutils autoconf automake autotools-dev libtool pkg-config \
zlib1g-dev libcunit1-dev libssl-dev libxml2-dev libev-dev libevent-dev libjansson-dev \
libc-ares-dev libjemalloc-dev cython python3-dev python-setuptools libjemalloc-dev \
libspdylay-dev
git clone https://github.com/nghttp2/nghttp2.git && cd nghttp2
autoreconf -i && automake && autoconf
@rafaelpatro
rafaelpatro / magento-address-autocomplete.js
Last active October 14, 2019 13:36
Magento Address Auto Fill based on Postcode
/**
* Address Auto Fill based on Postcode
*
* Author:
* Rafael Patro <rafaelpatro@gmail.com>
*
* Intallation:
* Add a CMS Static Block applying the entire script below.
* Add a Widget to pages with address forms.
*
<!-- Start Audima Widget Injection -->
<div id="audimaWidget"></div>
<script src="//audio.audima.co/audima-widget.js"></script>
<!-- End Audima Widget Injection -->
<!-- Audima CSS Customization -->
<style>
#audimaWidget .audima-panel {
/* Insira aqui a customização exemplo:
background-color: silver;
@paulofreitas
paulofreitas / security-http-headers.md
Last active June 11, 2021 16:22
Cabeçalhos de resposta HTTP relacionados a segurança

Content-Security-Policy, X-Content-Security-Policy, X-WebKit-CSP

O cabeçalho de resposta HTTP Content-Security-Policy permite aos administradores de sites controlar os recursos que o navegador ou agente de usuário (user agent) pode carregar em uma determinada página. Com algumas exceções, as políticas envolvem principalmente especificar as origens do servidor e os endpoints de script. Isso ajuda a proteger contra ataques de XSS.

O cabeçalho de respsota HTTP X-Content-Security-Policy é requerido para implementar o CSP no Internet Explorer 10 e 11.

O cabeçalho de resposta HTTTP X-Webkit-CSP é requerido para implementar o CSP em versões mais antigas do Google Chrome, Safari e outros navegadores baseados na engine WebKit.

Para navegadores modernos, o cabeçalho Content-Security-Policy deve ser usado.