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 / ga.js
Last active August 29, 2015 13:56
First draft for Google Analytics lib
window.Becklyn = (function (Becklyn, window, document) {
"use strict";
/**
* The settings as set by the initialization
*
* @type {Object}
*/
var settings;
@apfelbox
apfelbox / Codepad.php
Created February 13, 2014 10:01
Proof of Concept code for http://dev.apfelbox.net/simple_codepad/ (don't use it in production!)
<?php
class Codepad
{
/**
* Generates a new id and the file behind
*
* @return string
*/
public function generateNewId ()
@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);
parameters:
test: ["a", "b", 123]
# or
parameters:
test:
- "a"
- "b"
- 123