Skip to content

Instantly share code, notes, and snippets.

View wadmiraal's full-sized avatar

Wouter Admiraal wadmiraal

View GitHub Profile
@wadmiraal
wadmiraal / gist:6520040
Last active December 22, 2015 19:29
My first brainf* program. If you copy-paste this into the http://brainfuck.tk/ interpreter, and give it an input, it'll print "Wouter says [your input]".
++++++++ [ > ++++++++++ < - ] > +++++++ .
> +++++++++++ [ > ++++++++++ < - ] > + .
> +++++++++++ [ > ++++++++++ < - ] > +++++++ .
> +++++++++++ [ > ++++++++++ < - ] > ++++++ .
> ++++++++++ [ > ++++++++++ < - ] > + .
> +++++++++++ [ > ++++++++++ < - ] > ++++ .
> +++ [ > ++++++++++ < - ] > ++ .
> +++++++++++ [ > ++++++++++ < - ] > +++++ .
> +++++++++ [ > ++++++++++ < - ] > +++++++ .
> ++++++++++++ [ > ++++++++++ < - ] > + .
@wadmiraal
wadmiraal / gist:7532480
Created November 18, 2013 18:08
One useful use of override_function.
override_function('override_function', '$function_name, $function_args, $function_code', 'return override_function($function_name, $function_args, $function_code );');
@wadmiraal
wadmiraal / i_love_wp_sooo_much.php
Last active December 28, 2015 16:59
My first Wordpress plugin.
<?php
$all_functions = get_defined_functions();
$user_functions = $all_functions['user'];
foreach ($user_functions as $function_name) {
if (preg_match('/^wp_/', $function_name)) {
override_function($function_name, '', 'die("Use Drupal.");');
}
}
@wadmiraal
wadmiraal / 0_reuse_code.js
Created November 25, 2013 07:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@wadmiraal
wadmiraal / javascript_resources.md
Created November 25, 2013 07:06 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@wadmiraal
wadmiraal / css_resources.md
Created November 25, 2013 07:06 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

<?php
function THEMENAME_preprocess_page(&$variables) {
// Get the entire main menu tree
$main_menu_tree = menu_tree_all_data('main-menu', NULL, 3); // Provide max-depth.
// Add the rendered output to the $main_menu_expanded variable
$variables['main_menu_expanded'] = menu_tree_output($main_menu_tree);
}
<?php
/**
* @defgroup group_identifier Topic title goes here
* @{
* Summary line for the group/topic goes here.
*
* Additional documentation paragraphs go here.
*/
@wadmiraal
wadmiraal / Delay dropped-down menu hide by a few milliseconds.js
Last active February 29, 2016 17:47
Delay dropped-down menu hide by a few milliseconds, instead of just relying on CSS :hover. **Change main selector.**
$(document).ready(function() {
$('#header-main-menu li').hover(function() {
// Stop the timer.
clearTimeout(this.sfTimer);
// Display child lists.
$('> ul', this).css({left: 'auto', display: 'block'})
// Immediately hide nephew lists.
.parent().siblings('li').children('ul').css({left: '-999em', display: 'none'})
}, function() {
// Start the timer.
$('html, body').animate({ scrollTop: $('#some-element').offset().top }, 'slow');