Skip to content

Instantly share code, notes, and snippets.

View tyl3r's full-sized avatar
🐉
kap5ule.com

tyl3r

🐉
kap5ule.com
View GitHub Profile
<?php
define('BOT_TOKEN', 'XXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXX'); // place bot token of your bot here
function checkTelegramAuthorization($auth_data) {
$check_hash = $auth_data['hash'];
unset($auth_data['hash']);
$data_check_arr = [];
foreach ($auth_data as $key => $value) {
$data_check_arr[] = $key . '=' . $value;
@lesterchan
lesterchan / delete_wordpress_revisions.php
Last active August 29, 2015 14:15
Delete WordPress Revisions
<?php
/**
* Delete revisions from WordPress
*/
define( 'WP_USE_THEMES', false );
if( ! empty( $_SERVER['WP_DIR'] ) ) {
require( $_SERVER['WP_DIR'] . '/wp-blog-header.php' );
} elseif( is_file( 'wp-blog-header.php' ) ) {
require( 'wp-blog-header.php' );
} else {
@lesterchan
lesterchan / social_media_colors.css
Last active August 29, 2015 14:15
Social Media Colors
.color-pinterest {
color: #cb2027;
}
.color-facebook {
color: #3b5998;
}
.color-twitter {
color: #00aced;
}
.color-vimeo {
@ndarville
ndarville / webm.md
Last active September 30, 2023 18:56
4chan’s guide to converting GIF to WebM - https://boards.4chan.org/g/res/41212767

Grab ffmpeg from https://www.ffmpeg.org/download.html

It's a command line tool which means you will have to type things with your keyboard instead of clicking on buttons.

The most trivial operation would be converting gifs:

ffmpeg -i your_gif.gif -c:v libvpx -crf 12 -b:v 500K output.webm
  • -crf values can go from 4 to 63. Lower values mean better quality.
  • -b:v is the maximum allowed bitrate. Higher means better quality.
@justintadlock
justintadlock / register-post-type.php
Last active July 17, 2024 10:14
Help file when registering post types.
<?php
# Register custom post types on the 'init' hook.
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 1.0.0
* @access public
@setola
setola / functions.php
Last active September 25, 2020 18:29 — forked from johnmegahan/functions.php
Extended Walker class for use with the Twitter Bootstrap toolkit Dropdown n-levels menus in Wordpress.
<?php
/**
* Extended Walker class for use with the
* Twitter Bootstrap toolkit Dropdown menus in Wordpress.
* Edited to support n-levels submenu.
* @author johnmegahan https://gist.github.com/1597994, Emanuele 'Tex' Tessore https://gist.github.com/3765640
* @license CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
*/
class BootstrapNavMenuWalker extends Walker_Nav_Menu {
@luetkemj
luetkemj / wp-query-ref.php
Last active May 25, 2024 10:56
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@johnmegahan
johnmegahan / functions.php
Created January 12, 2012 01:50
Extended Walker class for use with the Twitter Bootstrap toolkit Dropdown menus in Wordpress.
<?php
add_action( 'after_setup_theme', 'bootstrap_setup' );
if ( ! function_exists( 'bootstrap_setup' ) ):
function bootstrap_setup(){
add_action( 'init', 'register_menu' );
@mikeschinkel
mikeschinkel / posts-by-taxonomy.php
Created November 6, 2010 01:50
Class to extended WordPress' 3.0.x WP_Query to allow querying for all terms in a taxonomy.
<?php
/*
PostsByTaxonomy class that extends WP_Query and filters to includes all posts that have any term of a taxonomy.
Author: Mike Schinkel (http://mikeschinkel.com)
This example works, just drop into the root of your website and call directly.
Use the class in your plugins or themes.
See:
@latompa
latompa / bayesian rating
Created January 8, 2009 01:02
bayesian rating
-- building on data from my scenario http://gist.github.com/44489
-- and bayesian rating http://www.thebroth.com/blog/118/bayesian-rating
assume we have a products table and we want to sort products based on their rating.
With bayesian rating, you get better weighting, so that a single 5 star vote won't show up as "top product"
select * from products;
mysql> select * from products;
+------+--------+---------------+--------------+---------+
| id | name | ratings_count | total_rating | weight |