Skip to content

Instantly share code, notes, and snippets.

View abouolia's full-sized avatar
🤠

Ahmed Bouhuolia abouolia

🤠
View GitHub Profile
anonymous
anonymous / index.html
Created November 12, 2014 18:42
// source http://jsbin.com/fezigapava
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
.pricing-table {
margin: 0 0 rem-calc(20) 0;
border: 0;
background-color: #f0f0f0;
@mjangda
mjangda / get_current_post_type.php
Created July 15, 2010 13:55
Get the current post_type context in the WordPress admin.
<?php
/**
* Gets the current global post type if one is set
*/
function x_get_current_post_type() {
global $post, $typenow, $current_screen;
if( $post && $post->post_type )
$post_type = $post->post_type;
elseif( $typenow )
<?php
add_action( 'init', function () {
global $shortcode_tags;
foreach ( $shortcode_tags as $tag => $function ) {
$shortcode_tags[$tag] = function ( $attr, $content = null ) use ( $tag, $function ) {
$expires = 60;
$expires = apply_filters( 'shortcode_cache_expires', $expires, $tag );
$cache_key = $tag . md5( serialize( $attr ) ) . get_the_ID();
$cached = wp_cache_get( $cache_key );
@elclanrs
elclanrs / v2p.html
Created December 19, 2012 22:10
Use CSS viewport units with jQuery
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="v2p.js"></script>
<style type="text/css" media="all">
body { margin: 0; }
div {
background: #fa7098;
}
@westonruter
westonruter / nav-menu-item-custom-fields.php
Created September 28, 2012 22:47
Proof of concept for how to add new fields to nav_menu_item posts in the WordPress menu editor.
<?php
/**
* Proof of concept for how to add new fields to nav_menu_item posts in the WordPress menu editor.
* @author Weston Ruter (@westonruter), X-Team
*/
add_action( 'init', array( 'XTeam_Nav_Menu_Item_Custom_Fields', 'setup' ) );
class XTeam_Nav_Menu_Item_Custom_Fields {
static $options = array(
@ohanhi
ohanhi / frp.md
Last active December 23, 2022 13:06
Learning FP the hard way: Experiences on the Elm language

Learning FP the hard way: Experiences on the Elm language

by Ossi Hanhinen, @ohanhi

with the support of Futurice 💚.

Licensed under CC BY 4.0.

Editorial note

<?php
/**
* Escape all translations with
*/
__( ‘Some String’, ‘text-domain’ ); _e( ‘Some string’, ‘text-domain’ );.
/**
* When there is no HTML use:
*/
@OliverJAsh
OliverJAsh / foo.tsx
Last active August 15, 2023 06:43
TypeScript React HOC using `forwardRef`
import * as React from 'react';
import { Component, ComponentClass, createRef, forwardRef, Ref } from 'react';
const myHoc = <ComposedComponentProps extends {}>(
ComposedComponent: ComponentClass<ComposedComponentProps>,
) => {
type ComposedComponentInstance = InstanceType<typeof ComposedComponent>;
type WrapperComponentProps = ComposedComponentProps & {
wrapperComponentProp: number;
@danny-englander
danny-englander / jquery.responsive-classes.js
Created September 13, 2012 00:16
JQuery Responsive Classes
/*
* Inspired by:
* http://designedbythomas.co.uk/blog/how-detect-width-web-browser-using-jquery
*
* This script is ideal for getting specific class depending on device width
* for enhanced theming. Media queries are fine in most cases but sometimes
* you want to target a specific JQuery call based on width. This will work
* for that. Be sure to put it first in your script file. Note that you could
* also target the body class instead of 'html' as well.
* Modify as needed
@jhamrick
jhamrick / genkeys.sh
Last active January 17, 2024 07:33
Generate SSL certificates with IP SAN
#!/usr/bin/env bash
#
# Generate a set of TLS credentials that can be used to run development mode.
#
# Based on script by Ash Wilson (@smashwilson)
# https://github.com/cloudpipe/cloudpipe/pull/45/files#diff-15
#
# usage: sh ./genkeys.sh NAME HOSTNAME IP
set -o errexit