Skip to content

Instantly share code, notes, and snippets.

View CanRau's full-sized avatar
🤓
coding

Can Rau CanRau

🤓
coding
View GitHub Profile
@CanRau
CanRau / git-notes
Last active August 14, 2016 15:13
git notes
/**
* Git create empty branch
*/
git checkout --orphan <branchname> # branch without parents
git rm --cached -r . # clear the working directory
/**
* rename git branch locally and remotely
* @from https://gist.github.com/lttlrck/9628955
<?php namespace ProcessWire;
/**
* An Inputfield for handling relational Page inputs
*
* Delegates the actual input control to a user-defined Inputfield derived from InputfieldSelect
*
* @method PageArray getSelectablePages(Page $page)
* @method PageArray findPagesCode(Page $page)
*
@CanRau
CanRau / jquery-to-vanilla-js.md
Last active August 29, 2015 14:26 — forked from jhafner/jquery-to-vanilla-js.md
jQuery methods in vanilla JavaScript.

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
// Override limit based on user input
if($userLimit = (int) $input->get->limit) {
$remeberLimit = "?limit=$userLimit";
$limit = $userLimit;
$input->whitelist('limit', $limit);
}
// Get year filter
if($userYear = (int) $sanitizer->selectorValue($input->get->year)) {
$year = $userYear;
<?php
/**
* Roskis
*
* Adds custom trash view that can be also accessed by defined roles
* Pages in trash can be searched, sorted and restored.
*
*
* Copyright 2013 by Antti Peisa