Skip to content

Instantly share code, notes, and snippets.

View matrixfox's full-sized avatar

Matrixfox matrixfox

View GitHub Profile
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);
<?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
@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
@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;
/ ==================================================
/ BOOTSTRAP NAVBAR DEFAULT HAML
/ http://getbootstrap.com/components/#navbar-default
/ ==================================================
%nav{'class' => 'navbar navbar-default', 'role' => 'navigation'}
/ Brand and toggle get grouped for better mobile display
%div.navbar-header
%button{'type' => 'button', 'class' => 'navbar-toggle', 'data-toggle' => 'collapse', 'data-target' => '#bs-example-navbar-collapse-1'}
%span.sr-only Toggle navigation
%span.icon-bar
<?php
$html = "";
$url = "http://ws.audioscrobbler.com/2.0/user/matrixfox/topartists.xml";
$xml = simplexml_load_file($url);
for($i = 0; $i < 10; $i++){
$title = $xml->artist[$i]->image['3'];
$title = str_replace("http://userserve-ak.last.fm/serve/252/","",$title);
$html .= "<img src='http://userserve-ak.last.fm/serve/252/$title'>";
}
echo $html;
@matrixfox
matrixfox / fakemail.js
Last active August 29, 2015 13:57
You suck at social attacks.school
var nodemailer = require("nodemailer");
// create reusable transport method (opens pool of SMTP connections)
var smtpTransport = nodemailer.createTransport({
service: "Gmail",
auth: {
user: "*******************",
pass: "*******************"
}
});
<?php
/**
* Loop Add to Cart
*/
global $product;
if( $product->get_price() === '' && $product->product_type != 'external' ) return;
?>

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream