Skip to content

Instantly share code, notes, and snippets.

@royboy789
royboy789 / Input.es5.js
Last active November 21, 2018 14:51
Learn Gutenberg es5 tutorial
var myComponents = myComponents || {};
var el = wp.element.createElement;
var __ = wp.i18n.__;
myComponents.inputComponent = function( id, attributes, changeCallback ) {
return el(
'input',
{
id: id + '-control',
value: attributes.who,
@terrymun
terrymun / bettermysql-sanitize-input.php
Last active August 29, 2015 14:27
Sanitising user inputs for other variables
<?php
// Assuming that database connection is already open
// Let's say a user is allowed to provide a table name to query from
$tableName = trim($_GET['tableName']);
// This would NOT work (no good!)
$stmt = $db->prepare("SELECT user, id, email FROM :table WHERE id > 1000");
$stmt->bindParam(':table', $tableName);
$stmt->execute();
@ourmaninamsterdam
ourmaninamsterdam / LICENSE
Last active February 9, 2025 08:41
Arrayzing - The JavaScript array cheatsheet
The MIT License (MIT)
Copyright (c) 2015 Justin Perry
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
@cameronjacobson
cameronjacobson / reactphp_middleware.php
Created November 12, 2012 17:46
reactphp/react socket server middleware
<?php
define('CLIENT_PORT', 10000);
define('HOST','127.0.0.1');
define('SERVER_PORT', 10001);
gc_enable();
$loop = React\EventLoop\Factory::create();
@deckerweb
deckerweb / functions.php
Last active October 10, 2015 07:17
WooCommerce: Change "Shipping and taxes are estimated..." text via Gettext filter -- only compatible until WCDE plugin version 3.0.13! // Nur kompatibel bis WCDE Pluginversion 3.0.13, nicht mit neueren Versionen!!!
<?php
/** Do NOT include the opening php tag */
// Nur kompatibel bis Pluginversion 3.0.13!! //
add_action( 'init', 'ddw_gettext_filter_woocommerce', 9999 );
/**
* Change the text in WooCommerce for "Shipping and taxes are estimated..." via Gettext filter.
*
@fnichol
fnichol / README.md
Created March 12, 2011 20:52
Download a cacert.pem for RailsInstaller

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)