Skip to content

Instantly share code, notes, and snippets.

View dantahoua's full-sized avatar

Vincent Morel dantahoua

View GitHub Profile
@jenssogaard
jenssogaard / ACF Gutenberg get block fields
Created February 22, 2019 21:08
Helper class for ACF and Gutenberg. Get blocks fields by passing block_id and post_id.
<?php
namespace JensSogaard;
class BlockHelper
{
/**
* Gets ACF fields for a specific block on a given post
* @author Jens Soegaard <jens@jenssogaard.com>
*/
public function getBlockFromPage(string $block_id, int $post_id)
@pixeline
pixeline / ajax-handler-wp.php
Last active October 5, 2022 13:09
Custom ajax handler for Wordpress. Using admin-ajax.php, as is usually recommended, is very slow and does not allow the use of plugin shortcodes. Using a custom ajax handler like this bypasses that. http://wordpress.stackexchange.com/questions/170808/the-content-shows-shortcode-instead-of-parsing-it
<?php
/*
WORDPRESS SPECIFIC AJAX HANDLER (because admin-ajax.php does not render plugin shortcodes).
by alexandre@pixeline.be
credits: Raz Ohad https://coderwall.com/p/of7y2q/faster-ajax-for-wordpress
*/
//mimic the actual admin-ajax
define('DOING_AJAX', true);
if (!isset( $_REQUEST['action']))
@willybahuaud
willybahuaud / translate-taxonomy-slug.php
Last active February 13, 2020 18:38
Translate Taxonomy base slug wpml
<?php
add_action( 'init', 'register_my_taxo' );
function register_my_taxo() {
register_taxonomy( 'immo_cat', 'immobilier', array(
'hierarchical' => false,
'label' => 'Type de biens',
// je déclare le slug de taxo de manière à pouvoir le traduire
'rewrite' => array( 'slug' => icl_t('nebula', 'property-type-slug', 'type-bien-immobilier' ) ),
) );
}
@matthewmueller
matthewmueller / osx-for-hackers.sh
Last active February 22, 2024 08:52
OSX for Hackers (Mavericks/Yosemite)
# OSX for Hackers (Mavericks/Yosemite)
#
# Source: https://gist.github.com/brandonb927/3195465
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Ask for the administrator password upfront
@chirag64
chirag64 / xrandr.sh
Last active February 10, 2024 02:30 — forked from debloper/xrandr.sh
Added license on user request
#!/bin/bash
# Copyright © 2021 Chirag Bhatia
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOF
/**
* Server Side
*/
var players = [];
var count = 0;
sails.io.on('connection', function (socket) {
var player = {};
socket.on('register', function (uuid) {
@awshout
awshout / foundation4-topbar-menu.php
Last active August 19, 2023 02:44
WordPress Menu & Walker for ZURB's Foundation 4 Top Bar
<?php
add_theme_support('menus');
/**
* Register Menus
* http://codex.wordpress.org/Function_Reference/register_nav_menus#Examples
*/
register_nav_menus(array(
'top-bar-l' => 'Left Top Bar', // registers the menu in the WordPress admin menu editor
'top-bar-r' => 'Right Top Bar'
@bluestrike2
bluestrike2 / symbolset.styl
Created August 4, 2012 07:49
Stylus stylesheet for symbolset icons
@charset "UTF-8";
@font-face
font-family: 'SS-Standard'
src: url("<%= asset_path('/assets/ss-standard.eot') %>")
src: url("<%= asset_path('/assets/ss-standard.eot?#iefix') %>") format('embedded-opentype'),
url("<%= asset_path('/assets/ss-standard.woff') %>") format('woff'),
url("<%= asset_path('/assets/ss-standard.ttf') %>") format('truetype'),
url("<%= asset_path('/assets/ss-standard.svg#SSStandard') %>") format('svg')
@font-face
font-family: 'SS-Social'
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/