Skip to content

Instantly share code, notes, and snippets.

View jesse1981's full-sized avatar
💭
Nerding

Jesse Bryant jesse1981

💭
Nerding
View GitHub Profile
@jesse1981
jesse1981 / scroll_infinite.js
Created May 7, 2013 23:44
A method to invoke increasing pagination when window scroll gets to the bottom.
$(window).scroll(function(){
var $window = $(this);
if($window.scrollTop() == $(document).height() - $window.height()) $('#more').click()
});
@jesse1981
jesse1981 / closest_descendent.js
Created May 7, 2013 23:44 — forked from lokimeyburg/closest_descendent.js
Find closest child element which matches given filter.
$.fn.closest_descendent = function(filter) {
var $found = $(),
$currentSet = this; // Current place
while ($currentSet.length) {
$found = $currentSet.filter(filter);
if ($found.length) break; // At least one match: break loop
// Get all children of the current set
$currentSet = $currentSet.children();
}
return $found.first(); // Return first match of the collection
@jesse1981
jesse1981 / XmlLoader.vbs
Created May 7, 2013 23:44 — forked from YujiSoftware/Module1.bas
XML Fetch/Parse example
Option Explicit
Public Function GetXmlData(url As String) As Object
'http://msdn.microsoft.com/ja-jp/library/aa468547.aspx
Dim dom As Object
Set dom = CreateObject("MSXML2.DOMDocument")
dom.async = False
'http://support.microsoft.com/kb/281142/ja
@jesse1981
jesse1981 / put-request.php
Created May 7, 2013 23:44 — forked from till/put-request.php
Example of reading PHP input data to array.
<?php
$_PUT = array();
parse_str(file_get_contents('php://input'), $_PUT);
?>
@jesse1981
jesse1981 / gist:5537104
Created May 7, 2013 23:43 — forked from cyberwani/gist:5432824
Prevent a plugin being updated with a Wordpress update
<?php
add_filter( 'http_request_args', 'my_plugin_prevent_update_check', 10, 2 );
function my_plugin_prevent_update_check( $r, $url ) {
if ( 0 === strpos( $url, 'http://api.wordpress.org/plugins/update-check/' ) ) {
$my_plugin = plugin_basename( __FILE__ );
$plugins = unserialize( $r['body']['plugins'] );
unset( $plugins->plugins[$my_plugin] );
unset( $plugins->active[array_search( $my_plugin, $plugins->active )] );
$r['body']['plugins'] = serialize( $plugins );
}
var FB = require('fb');
FB.api('oauth/access_token', {
client_id: process.env.FACEBOOK_APP_ID,
client_secret: process.env.FACEBOOK_SECRET,
grant_type: 'client_credentials'
}, function(res) {
if (!res || res.error) {
console.log('error occurred when getting access token:', res && res.error);
return;
@jesse1981
jesse1981 / fetchgrams.js
Created May 7, 2013 23:42 — forked from harthur/fetchgrams.js
Fetch Instagram images which contain specified tag.
var http = require("http"),
url = require("url"),
fs = require("fs"),
async = require("async"),
Instagram = require('instagram-node-lib');
Instagram.set('client_id', /* client key */);
Instagram.set('client_secret', /* client secret */);
fetchTag('cat', 400);