Skip to content

Instantly share code, notes, and snippets.

View pierre-dickinson's full-sized avatar
💭
Crafting Shopfolio

Pierre Dickinson pierre-dickinson

💭
Crafting Shopfolio
View GitHub Profile
@ivanlebanov
ivanlebanov / custom-ajax-spotify.php
Last active September 3, 2022 03:55
Spotify API integration with WordPress
<?php
function ajax_enquiry_init(){
wp_register_script('jquery', 'https://code.jquery.com/jquery-1.11.2.min.js' );
wp_enqueue_script('jquery');
wp_register_script('main', get_template_directory_uri() . '/js/main.js', array('jquery') );
wp_enqueue_script('main');
wp_localize_script( 'main', 'ajax_auth_object', array(
'ajaxurl' => admin_url( 'admin-ajax.php' ),
@tiger154
tiger154 / facebookEventCrawl.php
Created June 30, 2017 03:30
Facebook (public)event crawl
/**
* Here is short description each property and information
* - To parse url it use 'Embed\Http' from https://github.com/oscarotero/Embed/
*
* public $targetUrl: You can change to test
* private $endPoint: 'https://graph.facebook.com/' => It's shouldn't be changed
* private $facebooKey: XXXXXXXXXX => You must set proper facebookKey
* public $fields: You can change it to choose return data you want
* - cover field has image data: cover->source
* - Required field should be: name, description, cover
@jaredatch
jaredatch / functions.php
Last active February 28, 2022 22:04
WordPress Search Autocomplete using WP REST API v2
<?php
/**
* Enqueue scripts and styles.
*
* @since 1.0.0
*/
function ja_global_enqueues() {
wp_enqueue_style(
'jquery-auto-complete',
@RadGH
RadGH / short-number-format.php
Last active April 9, 2024 11:28
Short Number Formatter for PHP (1000 to 1k; 1m; 1b; 1t)
<?php
// Converts a number into a short version, eg: 1000 -> 1k
// Based on: http://stackoverflow.com/a/4371114
function number_format_short( $n, $precision = 1 ) {
if ($n < 900) {
// 0 - 900
$n_format = number_format($n, $precision);
$suffix = '';
} else if ($n < 900000) {
@adrienjoly
adrienjoly / startup-noob-guide.md
Last active March 31, 2024 04:37
Startup Noob Guide: Tips and resources on how to test, develop your startup idea, or find a developer/associate/CTO

Startup Noob Guide (bit.ly/startupnoob)

If you want to create a startup, and you've never done that before, you should consult the resources that are relevant to your situation.

[FR] Si vous comprenez le français, je vous invite à regarder la vidéo de mon pote Shubham qui résume assez bien le plus gros des conseils de cette page, en 8 minutes: Vous avez une idée de startup ?.

[FR] ...et si vous voulez comprendre tout ce contenu de manière plus efficace et ludique, inscrivez-vous sur mon MOOC "Startup Tour: créez votre startup en 3h" (gratuit).


@0xnbk
0xnbk / .php
Created September 13, 2010 06:30
Get the number of twitter follower in full text (PHP)
<?php
$xml=file_get_contents('http://twitter.com/users/show.xml?screen_name=catswhocode');
if (preg_match('/followers_count>(.*)</',$xml,$match)!=0) {
$tw['count'] = $match[1];
}
echo $tw['count'];
?>