Skip to content

Instantly share code, notes, and snippets.

View bjrnqprs's full-sized avatar

Björn Kuipers bjrnqprs

View GitHub Profile
Verifying that +bjornkuipers is my blockchain ID. https://onename.com/bjornkuipers
@bjrnqprs
bjrnqprs / .htaccess
Created August 2, 2015 08:36
Attempt to load files from production if they're not in our local version. Src: http://stevegrunwell.github.io/wordpress-git/#/13
<IfModule mod_rewrite.c>
RewriteEngine on
# Attempt to load files from production if they're not in our local version
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule wp-content/uploads/(.*) http://{PROD}/wp-content/uploads/$1 [NC,L]
</IfModule>
@bjrnqprs
bjrnqprs / functions.js
Created May 8, 2015 12:04
Collection of Javascript functions
function getCookieValue(key) {
currentcookie = document.cookie;
if (currentcookie.length > 0)
{
firstidx = currentcookie.indexOf(key + "=");
if (firstidx != -1)
{
firstidx = firstidx + key.length + 1;
lastidx = currentcookie.indexOf(";",firstidx);
if (lastidx == -1)
@bjrnqprs
bjrnqprs / gist:48c2e693a66ca8f389c3
Last active May 3, 2018 08:40 — forked from cedricziel/gist:6672142
Typo3 Extbase: Proper way to declare mapping's of tableName and columns.
config.tx_extbase {
persistence {
classes {
Vendor\MyPackage\Domain\Model\Organisation {
mapping {
columns {
tstamp.mapOnProperty = tstamp
hidden.mapOnProperty = hidden
crdate.mapOnProperty = crdate
cruser_id.mapOnProperty = cruserId
@bjrnqprs
bjrnqprs / tt_content.ts
Created March 8, 2014 10:14
TypoScript: Make File links element collapsible when choosing 'Layout 3'. #bootstrap
# Make collapsible for layout 3
tt_content.uploads {
10 >
10 = CASE
10 {
key.field = layout
3 = TEXT
3 {
field = header
@bjrnqprs
bjrnqprs / rsaauth_pwdmngr_fix.js
Created November 26, 2013 15:15
Typo3 RSA Auth extension (ext:rsaauth). Fix for allowing password managers to store the password.
/**
* For Typo3 EXT:rsaauth: Clones the password field before replacing its value.
* This allows password managers to save the entered password, instead of the hashed version.
*
* Load this code/file on the bottom of your page. Requires jQuery.
*
* WARNING: HTTPS is adviced when using this as the password is send clear-text as well.
*/
if(typeof tx_rsaauth_feencrypt == 'function') {
var orig_tx_rsaauth_feencrypt = window.tx_rsaauth_feencrypt;
@bjrnqprs
bjrnqprs / get-cookie-value.js
Created November 15, 2013 10:16
Get value of the given cookie, or empty string if not found.
@bjrnqprs
bjrnqprs / get-random-array-value.js
Created November 15, 2013 10:15
Return a random value from the given non-associative array
/**
* Return a random value from the given non-associative array
*
* @param array
* @returns {*}
*/
function getRandomArrayValue(array) {
return array[Math.floor(Math.random() * array.length)];
}
@bjrnqprs
bjrnqprs / nl2br.js
Created November 15, 2013 10:14
Convert new lines in given string to <br> tags.
function nl2br (str, is_xhtml) {
var breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '<br />' : '<br>';
return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + breakTag + '$2');
}
@bjrnqprs
bjrnqprs / open-popup-center.js
Created November 15, 2013 10:13
Open a popup window in the center of the screen
/**
* Opens a popup in the center of the screen
*
* @param url
* @param title
* @param width
* @param height
* @returns {window}
*/
function openPopupCenter(url, title, width, height) {