Skip to content

Instantly share code, notes, and snippets.

View adamkiss's full-sized avatar
🐱
Cats are awesome.

Adam Kiss adamkiss

🐱
Cats are awesome.
View GitHub Profile
@adamkiss
adamkiss / gist:1291526
Created October 16, 2011 22:39
Testing HTML gist for inclusion
<!doctype html>
<?php
//testing php inline like a motherfucker
$test = (is_highlighted()) ? 'true' : false;
$test++;
?>
<html>
<head>
@adamkiss
adamkiss / gist:2397520
Created April 16, 2012 10:20 — forked from axelav/gist:1839777
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@adamkiss
adamkiss / gist:2484276
Created April 24, 2012 22:19
ProcessWire user access 909 (uber-advanced)
<?php
//This just blew my mind
//
//User has field 'userPages'[Pagefield type], where administrator added parts of whole tree avail. to user.
//This checks whether current page (wrapped in object) or any of its parents was added to this 'userPages'
//(thus current page or anything higher in the hierarchy gives user the access)
//wow.
$access =
count(
@adamkiss
adamkiss / gist:4215822
Created December 5, 2012 14:20
EE's 'switch' – template function in pure PHP
<?php
$ee_switch_global = array();
function switch(){
global $ee_switch_global;
$args = func_get_args();
$key = array_shift($args);
if (array_key_exists($key,$ee_switch_global)){
$index = $ee_switch_global[$key]++;
@adamkiss
adamkiss / TextformatterTempTags.php
Created December 7, 2012 14:35
PW TextFormatter – {{ something }} parsing module
<?php
/**
* Temporary Tags for Text fields
*
* I need to push my site out ASAP, fast. I need this.
*
* @author Adam Kiss
* @version 1.0
* @since 2012-09-20
@adamkiss
adamkiss / lib.js
Created March 31, 2017 20:57
Require fresh module each time (as a function in lib.js)
'use strict'
module.exports = {
require_fresh: function (file) {
delete require.cache[require.resolve(file)]
return require(file)
}
}
@adamkiss
adamkiss / stuff.scss
Created May 2, 2017 11:25
Testing ruleset generation Sass
$breakpoints-list: (
ns: '>=44em'
);
$ruleset: (
bg-r: ('background red'),
bg-g: ('background green', top 10px)
);
$breakpoints: ns;
extends(src='layout.sgr')
block(name='styles' type='append')
// normal link
link(rel='stylesheet' href='/css/home-hero.css')
// function for reshape-content
style(inline) /css/home-hero.css
// reshape custom element plugin
module.exports = class Transform {
constructor (opts) {
this.opts = opts
this.apply = this.apply.bind(this)
}
apply (compiler) {
const transforms = (Array.isArray(this.opts)) ? this.opts : [this.opts]
compiler.plugin('emit', function(compilation, done) {
@adamkiss
adamkiss / _index.php
Last active March 5, 2020 20:12
Dynamic Blueprints in Kirby
<?php
use Kirby\Cms\App as Kirby;
use Kirby\Data\Data;
Kirby::plugin('adamkiss/dynamic-blueprint', [
'hooks' => [
'system.loadPlugins:after' => function() {
// load base (this could be dynamic as well. Should even)
$fakeBlueprint = Data::read(__DIR__ . '/fake-kirby-request.yml');