Skip to content

Instantly share code, notes, and snippets.

View nadinejerome's full-sized avatar
🎯
Focusing

Nadine Jerome nadinejerome

🎯
Focusing
  • Virginia
View GitHub Profile
@nadinejerome
nadinejerome / instagram_scrape.php
Created September 26, 2016 11:40 — forked from cosmocatalano/instagram_scrape.php
Quick-and-dirty Instagram web scrape, just in case you don't think you should have to make your users log in to deliver them public photos.
<?php
//returns a big old hunk of JSON from a non-private IG account page.
function scrape_insta($username) {
$insta_source = file_get_contents('http://instagram.com/'.$username);
$shards = explode('window._sharedData = ', $insta_source);
$insta_json = explode(';</script>', $shards[1]);
$insta_array = json_decode($insta_json[0], TRUE);
return $insta_array;
}
@nadinejerome
nadinejerome / WordpressValidationCheck.php
Last active August 5, 2016 13:43
Wordpress Validation Callback
<?php
// Wordprs 4.6
//supply a sanitize_callback when registering a setting, you can also supply a validate_callback arg
$wp_customize->add_setting( 'established_year', array(
'sanitize_callback' => 'absint',
'validate_callback' => 'validate_established_year'
) );
function validate_established_year( $validity, $value ) {
$value = intval( $value );
<?php
// Resizer and Image Manipulation
// Based on: http://forums.laravel.com/viewtopic.php?id=2648
public function post_edit_logo($id)
{
$rules = array(
'image' => 'image',
);