Skip to content

Instantly share code, notes, and snippets.

View apfelbox's full-sized avatar
🥑
hi there!

Jannik apfelbox

🥑
hi there!
View GitHub Profile
@apfelbox
apfelbox / Article.md
Created March 11, 2015 10:56
Improved double ampersand mixin for Sass

The double ampersand -- or as A list apart called it "lobotomized owl selector" -- is a CSS rule that looks like the following:

* + * {
	/* some declarations */
}

You can also use it with a specific selector:

@apfelbox
apfelbox / gulpfile.js
Last active February 21, 2017 15:26
(gulp + browserify) - gulp-browserify
var watch = require("gulp-watch");
var plumber = require("gulp-plumber");
var tap = require("gulp-tap");
var browserify = require("browserify");
var gulpif = require("gulp-if");
var streamify = require("gulp-streamify");
var gutil = require('gulp-util');
var isDebug = false;
@apfelbox
apfelbox / Parser.php
Last active August 12, 2016 09:59
Adjusted parser to render paragraphs which only contain a single image without the paragraph. So instead <p><img ...></p> it just renders<img ...>
<?php
/**
* Adjusted parser to render paragraphs which only contain a single image without the paragraph.
*
* So instead
* <p><img ...></p>
*
* it just renders
* <img ...>
@apfelbox
apfelbox / hover-navbar.js
Last active January 4, 2016 00:19
Add Bootstrap hover dropdowns and make dropdown-toggle item clickable.1. Just don't add `data-toggle="dropdown"`2.1 JS: Load this code (hover-navbar.js)2.2 CSS: Add this code (hover-navbar.css)(not both, just one of them)
(function ($)
{
"use strict";
$(".navbar .nav")
.on("mouseenter", "li.dropdown", onMouseEnter)
.on("mouseleave", "li.dropdown", onMouseLeave);
/**
* Callback on mouse enter
diff --git cms-page-order.php cms-page-order.php
index 51d2b9e333c3cc83c75842fbbcf7e8ab65b41e06..ddfabb28bd6dfec09067eb36f8b8a028a4678e62 100644
--- cms-page-order.php
+++ cms-page-order.php
@@ -350,15 +350,15 @@ function cmspo_do_err() {
/** Special Walker for the Pages */
class PO_Walker extends Walker_Page {
- function start_lvl(&$output, $depth) {
+ function start_lvl(&$output, $depth = 0, $args = array() ) {
@apfelbox
apfelbox / countries.php
Created January 13, 2014 15:58
Country List for usage in PHP. Generated by `\Symfony\Component\Intl\Intl::getRegionBundle()->getCountryNames()`.
<?php
return array ( 'AF' => 'Afghanistan', 'EG' => 'Ägypten', 'AX' => 'Alandinseln', 'AL' => 'Albanien', 'DZ' => 'Algerien', 'UM' => 'Amerikanisch-Ozeanien', 'AS' => 'Amerikanisch-Samoa', 'VI' => 'Amerikanische Jungferninseln', 'AD' => 'Andorra', 'AO' => 'Angola', 'AI' => 'Anguilla', 'AQ' => 'Antarktis', 'AG' => 'Antigua und Barbuda', 'GQ' => 'Äquatorialguinea', 'AR' => 'Argentinien', 'AM' => 'Armenien', 'AW' => 'Aruba', 'AZ' => 'Aserbaidschan', 'ET' => 'Äthiopien', 'QO' => 'Äußeres Ozeanien', 'AU' => 'Australien', 'BS' => 'Bahamas', 'BH' => 'Bahrain', 'BD' => 'Bangladesch', 'BB' => 'Barbados', 'BY' => 'Belarus', 'BE' => 'Belgien', 'BZ' => 'Belize', 'BJ' => 'Benin', 'BM' => 'Bermuda', 'BT' => 'Bhutan', 'BO' => 'Bolivien', 'BA' => 'Bosnien und Herzegowina', 'BW' => 'Botsuana', 'BV' => 'Bouvetinsel', 'BR' => 'Brasilien', 'VG' => 'Britische Jungferninseln', 'IO' => 'Britisches Territorium im Indischen Ozean', 'BN' => 'Brunei Darussalam', 'BG' => 'Bulgarien', 'BF' => 'Burkina Faso', 'BI' => 'Burundi', 'CL' => '
@apfelbox
apfelbox / Extension.php
Created November 21, 2013 10:30
varargs in Twig custom functions
<?php
class Extension extends Twig_Extension
{
public function myFunc ()
{
var_dump(func_get_args());
}
@apfelbox
apfelbox / fb-scroll.js
Created November 18, 2013 13:25
How to scroll in a facebook app
function _scrollToTop ()
{
FB.Canvas.getPageInfo(
function(pageInfo)
{
$({ y: pageInfo.scrollTop }).animate(
{ y: 0 },
{
@apfelbox
apfelbox / index.html
Created October 23, 2013 14:57
Retina CSS example
<!doctype html>
<html>
<head>
<title>CSS Sprites + Retina</title>
<meta charset="utf-8" />
<style type="text/css">
.with-retina,
.without-retina {
@apfelbox
apfelbox / AdminController.php
Last active December 14, 2015 20:09
PHPExcel + Symfony2
<?php
$participantModel = new ParticipantModel($this->container);
$filename = "participations_" . date("d_m_Y__H_i") . "_export.xls";
$excel = $participantModel->getExcelHandler();
$writer = \PHPExcel_IOFactory::createWriter($excel, "Excel5");
$handle = fopen("php://temp", "a");
$writer->save($handle);