Skip to content

Instantly share code, notes, and snippets.

View LostKobrakai's full-sized avatar

Benjamin Milde LostKobrakai

View GitHub Profile
@LostKobrakai
LostKobrakai / fieldRemove.php
Last active August 29, 2015 14:06
ProcessWire: Remove field via API
<?php
if ($user->isSuperuser()) {
//first remove the fields from 'user' template before deleting them.
$t = $templates->get('user');
$fg = $t->fieldgroup;
$fg->remove($fields->get('your_field'));
$fg->save();
//delete the fields
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
a, img{
display: block;
}
@LostKobrakai
LostKobrakai / gist:d09128adf13bbf588679
Created February 2, 2015 17:27
Combine each element to another.
<?php
$array = ["lot's", "of", "elements", "…"];
$allConcatinations = [];
for ($a=0; $a<count($array); $a++) {
for ($b=$a+1; $b<count($array); $b++) {
array_push($allConcatinations, $array[$a]." ".$array[$b]);
}
}
<?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}