Skip to content

Instantly share code, notes, and snippets.

View LostKobrakai's full-sized avatar

Benjamin Milde LostKobrakai

View GitHub Profile
@LostKobrakai
LostKobrakai / Multisite.module.php
Last active November 19, 2020 01:58
Multisite routing for ProcessWire
<?php
// source: https://processwire.com/talk/topic/680-multiple-sites-from-one-install/?p=8778
class Multisite extends WireData implements Module, ConfigurableModule {
public static function getModuleInfo() {
return array(
'title' => 'Multisite',
'version' => 1,
<?php
// Variables used in this script:
// $summary - text title of the event
// $datestart - the starting date (in seconds since unix epoch)
// $dateend - the ending date (in seconds since unix epoch)
// $address - the event's address
// $uri - the URL of the event (add http://)
// $description - text description of the event
// $filename - the name of this file for saving (e.g. my-event-name.ics)
//
@LostKobrakai
LostKobrakai / functions.js
Last active August 29, 2015 14:27 — forked from gilbert/functions.js
JavaScript Function Extensions
// Partially apply arguments to a function. Useful for binding
// specific data to an event handler.
// Example:
//
// var add = function (x,y) { return x + y }
// var add5 = add.papp(5)
// add5(7) //=> 11
//
Function.prototype.papp = function () {
var slice = Array.prototype.slice
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JS Bin</title>
<style id="jsbin-css">
html {
box-sizing: border-box;
}
<?php
echo wire('pages')->getPageFinder()->find(new Selectors($selector), array("returnQuery" => true))->getQuery();
@LostKobrakai
LostKobrakai / SassMeister-input-HTML.html
Last active December 3, 2015 08:51
Generated by SassMeister.com.
<ul class="breadcrumb">
<li class="breadcrumb__item">First</li>
<li class="breadcrumb__item">Next</li>
</ul>
<ul class="breadcrumb2">
<li>First</li>
<li>Next</li>
</ul>
@LostKobrakai
LostKobrakai / SassMeister-input.sass
Created December 3, 2015 15:18
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
=e($name)
@at-root &__#{$name}
@content
=m($name)
@at-root &--#{$name}
@LostKobrakai
LostKobrakai / SassMeister-input.sass
Created December 3, 2015 15:19
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
=e($name)
@at-root &__#{$name}
@content
=m($name)
@at-root &--#{$name}
@LostKobrakai
LostKobrakai / gist:4b244b810f6e966b68773d865eb09b1c
Last active March 30, 2016 19:27
Nette forms conditional inputfield addition
<?php
use Nette\Forms\Form;
$addField = function($form, array $required, array $hidden, $fieldname, $groupname, callable $callback = null)
{
// $groupname is optional
if(is_callable($groupname)){
$callback = $groupname;
$groupname = '';
@LostKobrakai
LostKobrakai / dump.php
Last active May 30, 2016 12:38
dump() macro for Laravel's Collection class
<?php
/**
* Instead of creating unnecessary temp. variables
* just put ->dump() whereever in your chain you need to
* look at the current collection data.
*/
Collection::macro('dump', function () {
var_dump($this);
return $this;