Skip to content

Instantly share code, notes, and snippets.

View tanatip's full-sized avatar
🏠
Working from home

Tanatip Siriprathum tanatip

🏠
Working from home
View GitHub Profile
@danielpataki
danielpataki / ajax-action.php
Last active April 17, 2021 14:02
Twenty Fifteen AJAX
add_action( 'wp_ajax_nopriv_ajax_pagination', 'my_ajax_pagination' );
add_action( 'wp_ajax_ajax_pagination', 'my_ajax_pagination' );
function my_ajax_pagination() {
echo get_bloginfo( 'title' );
die();
}
#!/bin/bash
# (not really -- run these commands by hand & pay attention to the comments)
# Homebrew: The missing package manager for OS X
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Git
brew install git
git config --global --add merge.ff false
@joshuadavidnelson
joshuadavidnelson / basic-usage.php
Last active July 27, 2018 11:32
Create custom theme features with theme feature support
<?php
/**
* Basic Theme Support usage. Add this to your functions.php file
*/
add_theme_support( 'custom-footer-text' );
/**
* Elsewhere in your theme...
*/
if( current_theme_supports( 'custom-footer-text' ) ) {
@staltz
staltz / introrx.md
Last active April 19, 2025 05:15
The introduction to Reactive Programming you've been missing
@JakeWharton
JakeWharton / Truss.java
Last active August 12, 2024 07:31
Extremely simple wrapper around SpannableStringBuilder to make the API more logical and less awful. Apache 2 licensed.
import android.text.SpannableStringBuilder;
import java.util.ArrayDeque;
import java.util.Deque;
import static android.text.Spanned.SPAN_INCLUSIVE_EXCLUSIVE;
/** A {@link SpannableStringBuilder} wrapper whose API doesn't make me want to stab my eyes out. */
public class Truss {
private final SpannableStringBuilder builder;
private final Deque<Span> stack;
@adamsilverstein
adamsilverstein / expanded_alowed_tags
Last active April 3, 2024 18:15
WordPress expanded allowed tags for wp_kses with iframe, forms, etc.
function expanded_alowed_tags() {
$my_allowed = wp_kses_allowed_html( 'post' );
// iframe
$my_allowed['iframe'] = array(
'src' => array(),
'height' => array(),
'width' => array(),
'frameborder' => array(),
'allowfullscreen' => array(),
);
<?php
/**
ReduxFramework Sample Config File
For full documentation, please visit: https://docs.reduxframework.com
* */
if (!class_exists('Redux_Framework_sample_config')) {
class Redux_Framework_sample_config {
@thomasfr
thomasfr / Git push deployment in 7 easy steps.md
Last active July 3, 2024 02:22
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
@chantastic
chantastic / gulpfile.js
Last active October 13, 2023 03:20
This a script for a Full Stack Talk, given 3/13/14. Feel free to follow along at your own pace.
var gulp = require('gulp');
var coffee = require('gulp-coffee');
gulp.task('scripts', function () {
gulp.src('src/*.coffee')
.pipe(coffee())
.pipe(gulp.dest('./'));
});
gulp.task('watch', function () {
@BronsonQuick
BronsonQuick / post_thumbnail_html_foundation_wordpress.php
Created February 18, 2014 05:46
A gist to show how I am filtering post_thumbnail_html to output Foundations Interchange markup on www.sennza.com.au
<?php
/**
* We need to filter our post thumbnails so we can output them in a format that Foundations Interchange needs.
* We also need a fallback for no JavaScript
*
* @param $html
* @param $post_id
* @param $post_thumbnail_id
* @param $size
* @param $attr