Skip to content

Instantly share code, notes, and snippets.

@avafloww
avafloww / PhpJava.java
Last active October 16, 2022 18:50
This snippet of code is syntactically valid in both PHP and Java, and produces the same output in both.
/*<?php
//*/public class PhpJava { public static void main(String[] args) { System.out.printf("/*%s",
//\u000A\u002F\u002A
class PhpJava {
static function main() {
echo(//\u000A\u002A\u002F
"Hello World!");
}}
//\u000A\u002F\u002A
PhpJava::main();
@shannonmoeller
shannonmoeller / multiline-regexp.js
Last active April 12, 2021 22:16
Multiline Regular Expressions using ES6 Template Strings
/**
* Inspired by XRegExp via 2ality
* http://www.2ality.com/2012/12/template-strings-xregexp.html
* http://xregexp.com/
*/
import test from 'ava';
export function rx(flags) {
const trailingComments = /\s+#.*$/gm;
@pepijnblom
pepijnblom / migrate.sh
Last active November 18, 2020 22:20 — forked from tobi-pb/migrate.sh
Upgrade MAMP to Mysql 5.7
#!/bin/sh
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.15-osx10.11-x86_64.tar.gz
tar xfvz mysql-5.7*
echo "stopping mamp"
sudo /Applications/MAMP/bin/stop.sh
sudo killall httpd mysqld
echo "creating backup"
@nucliweb
nucliweb / fortune-cowsay-lolcat.md
Last active April 3, 2022 01:22
fortune | cowsay | lolcat

fortune | cowsay | lolcat

Install Brew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install fortune

brew search fortune
@croxton
croxton / gist:7773beb5fe44d9f9a66a
Last active April 8, 2018 02:24
Previews with Resource Router

###Secure previews of draft entries with Resource Router

  1. Make a copy of index.php and call it preview.php. Add any custom config values in preview.php that you might like when previewing entries, such as disabling caching.

  2. Create a rule for Resource Router that looks something like this:

    $config['resource_router'] = array(
    
    	// match any url
@bryanburgers
bryanburgers / template.html
Created May 14, 2015 02:30
Group adjacent blocks of the same type together.
{!--
> Awesome. Just had an Ah-ha! moment. Build small blocks, then add
> multiple Block fields to a channel with specific blocks in.
-- @JayHealy, https://twitter.com/JayHealey/status/598668322301837312
--}
{cf_page_content}
@imjasonh
imjasonh / markdown.css
Last active February 12, 2024 17:18
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@shannonmoeller
shannonmoeller / sprinkle.js
Last active August 29, 2015 14:09
sprinkle
var a = [
'a', 'aa', 'aaa', 'aaaa', 'aaaaa',
'b', 'bb', 'bbb', 'bbbb', 'bbbbb',
'c', 'cc', 'ccc', 'cccc', 'ccccc'
];
var b = [
'Z', 'ZZ', 'ZZZ'
];
@GDmac
GDmac / pi.debug_override.php
Created June 22, 2014 08:55
Debug Override plugin, disable ExpressionEngine template debugging from a template
<?php
$plugin_info = array(
'pi_name' => 'debug_override',
'pi_version' =>'1.0',
'pi_author' =>'GDmac',
'pi_author_url' => '',
'pi_description' => '',
'pi_usage' => '{exp:debug_override override="all|ajax"} default is override on ajax calls',
);
@croxton
croxton / cpanel_vps_eecms_config.md
Last active September 5, 2021 23:34
Battle-tested cPanel VPS server configuration for medium traffic ExpressionEngine websites

"Medium traffic" = able to handle around 50 concurrent users on average.

If you want to handle 100+ concurrent users with the same modest hardware see the Varnish section below.

VPS

  • 4096 MB memory
  • 125GB SSD
  • 4 CPUs
  • Cpanel