Skip to content

Instantly share code, notes, and snippets.

View philpoore's full-sized avatar
🏠
Working from home

Phil Poore philpoore

🏠
Working from home
View GitHub Profile
/blog/
/blog/?m=201107
/blog/?p=107
/blog/?p=134
/blog/?p=138
/blog/?p=139
/blog/?p=153
/blog/?p=74
/blog/?tag=f1-simulators
@philpoore
philpoore / gist:be5a497f46a38cffd60d
Created September 27, 2014 15:38
SOME SQL EXAMPLE
select * from users
where 1=1
and name = 'friend'
i add more stuff
@philpoore
philpoore / basic-http-server.js
Created October 9, 2014 03:34
Basic HTTP Server
require('express')().use(function (req, res){
res.end(require('fs').readFileSync(req.url.slice(1) || 'index.html'))
}).listen(process.argv[2])
@philpoore
philpoore / print_time
Created October 9, 2014 05:27
Linux Bash: Print Time
#!/bin/bash
while true
do sleep 600; echo `date "+%H:%M:%S"`
done
@philpoore
philpoore / speak.html
Created October 9, 2014 05:28
api.api Speak Recognition Example Demo
<html>
<head>
<title>API Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
var accessToken = "<your agent access token>";
var subscriptionKey = "<your agent subscription key>";
var baseUrl = "https://api.api.ai/v1/";
@philpoore
philpoore / server.js
Created November 5, 2014 13:07
Simple HTTP Server
var express = require('express');
var morgan = require('morgan');
var app = new express();
app
.use(morgan('common'))
.use(function (req,res){
res.end('hello world');
}).listen(process.env.PORT || 8080);

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@philpoore
philpoore / .bowerrc
Last active August 29, 2015 14:13 — forked from leon/.bowerrc
{
"directory": "bower_components",
"json": "bower.json"
}
@philpoore
philpoore / Dockerfile
Last active August 29, 2015 14:20
Dockerfile - nodejs
FROM node:0.10
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json /usr/src/app/
RUN npm install
COPY . /usr/src/app
@philpoore
philpoore / gist:e018a3cb5b683b64988e
Last active August 29, 2015 14:20
Update Mongo 2.4 to 2.6
#!/bin/bash
service mongod stop
echo > /etc/yum.repos.d/mongodb-org-2.6.repo
echo "[mongodb-org-2.6]" >> /etc/yum.repos.d/mongodb-org-2.6.repo
echo "name=MongoDB 2.6 Repository" >> /etc/yum.repos.d/mongodb-org-2.6.repo
echo "baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/" >> /etc/yum.repos.d/mongodb-org-2.6.repo