Skip to content

Instantly share code, notes, and snippets.

View matrixfox's full-sized avatar

Matrixfox matrixfox

View GitHub Profile
@matrixfox
matrixfox / jquery.media-queries.js
Created November 22, 2013 22:06
jQuery Media Queries, add your code and resize the browser.
var delay = (function(){
var timer = 0;
return function(callback, ms){
clearTimeout (timer);
timer = setTimeout(callback, ms);
};
})();
$(function() {
var pause = 100;
@matrixfox
matrixfox / tweet-entities.php
Last active December 29, 2015 00:19
This makes use of Twitters API 1.1 Entities https://dev.twitter.com/docs/entities
<?php
$code = $tweets->text;
//Convert urls to <a> links
$code = preg_replace("/([\w]+\:\/\/[\w-?&;#~=\.\/\@]+[\w\/])/", "<a target=\"_blank\" href=\"$1\">$1</a>", $code);
//Convert hashtags to twitter searches in <a> links
$code = preg_replace("/#([A-Za-z0-9\/\.]*)/", "<a target=\"_new\" href=\"http://twitter.com/search?q=$1\">#$1</a>", $code);
//Convert attags to twitter profiles in <a> links
<?php
require 'tmhOAuth.php'; // Get it from: https://github.com/themattharris/tmhOAuth
// Use the data from http://dev.twitter.com/apps to fill out this info
// notice the slight name difference in the last two items)
$connection = new tmhOAuth(array(
'consumer_key' => '',
'consumer_secret' => '',
'user_token' => '', //access token
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);