This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require("request"), | |
cheerio = require("cheerio"), | |
root = "http://gamemusic.siroro.co.uk/"; | |
function process(url, dir) { | |
request(url, function(error, response, body) { | |
if (!error) { | |
var $ = cheerio.load(body), | |
filenames = $("span.file-name"), | |
alert = $("div.alert")[0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using Mac you will need importing cooffe-script library: | |
sudo npm install -g coffee-script | |
# now you can convert cooffee-scripts ("compressed" version of a normal javascript file) into more familiar JS, i.e | |
coffee -c --output gamejs/ game/ | |
#which converts all file into game/ in a new directory called gamejs/. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/******************************** | |
This code will allow you to create your own shortcode. | |
*************************************/ | |
// SHORTCODE FOR GOOGLE ADSENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// github gist Shortcode Usage: [gist un="" id=""] | |
function gist_shortcode( $atts ) { | |
extract(shortcode_atts(array( | |
'un' => '', | |
'id' => '' | |
), $atts)); | |
return '<script src="https://gist.github.com/' . $username . '/' . $id.'.js"></script>'; | |
} | |
add_shortcode('gist', 'gist_shortcode'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'wp_ajax_button_click', 'user_clicked' ); | |
function user_clicked() { | |
update_user_meta( get_current_user_id(), 'clicked_link', 'yes' ); | |
wp_redirect( $_SERVER['HTTP_REFERER'] ); | |
exit(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function writeLog($string) { | |
$log_file = dirname(__FILE__) . '/log.txt'; | |
if ($fh = @fopen($log_file, "a+")) { | |
fputs($fh, $string, strlen($string)); | |
fclose($fh); | |
return true; | |
} | |
else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:regex | |
jQuery.expr[':'].regex = function(elem, index, match) { | |
var matchParams = match[3].split(','), | |
validLabels = /^(data|css):/, | |
attr = { | |
method: matchParams[0].match(validLabels) ? | |
matchParams[0].split(':')[0] : 'attr', | |
property: matchParams.shift().replace(validLabels,'') | |
}, | |
regexFlags = 'ig', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** You could put this in the bp-custom.php file | |
* @see http://codex.buddypress.org/themes/bp-custom-php/ | |
*/ | |
function custom_bbpress_maybe_load_mentions_scripts( $retval = false ) { | |
if ( function_exists( 'bbpress' ) && is_bbpress() ) { | |
$retval = true; | |
} | |
return $retval; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Adds all user meta to the /wp-json/wp/v2/user/[id] endpoint */ | |
function sb_user_meta( $data, $field_name, $request ) { | |
if( $data['id'] ){ | |
$user_meta = get_user_meta( $data['id'] ); | |
} | |
if ( !$user_meta ) { | |
return new WP_Error( 'No user meta found', 'No user meta found', array( 'status' => 404 ) ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
$(document).ready(function () { | |
$('#next').click(function () { | |
$.post( | |
PT_Ajax.ajaxurl, | |
{ | |
// wp ajax action | |
action: 'ajax-inputtitleSubmit', | |
// vars |
OlderNewer