Skip to content

Instantly share code, notes, and snippets.

View bjrnqprs's full-sized avatar

Björn Kuipers bjrnqprs

View GitHub Profile
@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 / 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 / .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>
Verifying that +bjornkuipers is my blockchain ID. https://onename.com/bjornkuipers
<?php
/**
* Clears the cache based on the command $cacheCmd.
*
* $cacheCmd='pages': Clears cache for all pages. Requires admin-flag to
* be set for BE_USER.
*
* $cacheCmd='all': Clears all cache_tables. This is necessary if
* templates are updated. Requires admin-flag to be set for BE_USER.
*
@bjrnqprs
bjrnqprs / CmdNameCommandController.php
Created June 11, 2013 13:50
Typo3 6 + ExtBase: Way to create scheduler tasks using namespace's and Extbase's CommandController.
<?php
namespace VENDOR\ExtName\Command;
class CmdNameCommandController extends \TYPO3\CMS\Extbase\Mvc\Controller\CommandController {
public function fooCommand($bar) {
echo "foo\n";
}
}
// Source: http://stackoverflow.com/a/14823315/440643
var _show = $.fn.modal.Constructor.prototype.show;
$.fn.modal.Constructor.prototype.show = function() {
_show.apply(this, arguments);
//Do custom stuff here
};
@bjrnqprs
bjrnqprs / gist:5868920
Last active December 19, 2015 00:29
Extend Typeahead (Twitter Bootstrap) with an onshow function. When initializing Typeahead, allows for defining onshow: function() {}.
(function($) {
if($.fn.typeahead != 'undefined') {
var _show = $.fn.typeahead.Constructor.prototype.show;
$.fn.typeahead.Constructor.prototype.show = function() {
if(typeof this.options.onshow == 'function') {
this.options.onshow();
}
// Call parent
@bjrnqprs
bjrnqprs / jquery.getObjectLength.js
Created July 20, 2013 14:22
jQuery function to retrieve the size of an object.
jQuery.extend({
getObjectLength: function(obj){
var length = 0;
if(typeof obj == 'object') {
if(Object.keys) {
length = Object.keys(obj).length;
} else {
var i;
@bjrnqprs
bjrnqprs / multi-lang-domain.php
Created August 27, 2013 11:46
Default RealUrl configuration. Might expand this later.
<?php
/**
* Setup multi-language/domain config
*
* NOTE: Multiple domains for a single language will not work.
* The first defined domain is used in that case.
*/
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DOMAINS'] = array(
'encode' => array(