Skip to content

Instantly share code, notes, and snippets.

Mike Knoop mikeknoop

Block or report user

Report or block mikeknoop

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View html-header.php
<?php $blog = true; // only set on blog pages ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php
$title = "Mike Knoop | Founder, Web Developer, and Mechanical Engineer";
$description = "Personal archive and blog for all the awesome stuff I work on, including my current startup Zapier. Connect with me on Twitter and Google+.";
if ($blog) {
$title = "Blog | Mike Knoop";
if (!$all_posts) {
$title = get_post()->post_title . " | Mike Knoop";
View webscript.lua
-- this script will receive a click, trigger a zapier webhook POST
-- then redirect the user on to the final location
zid = request.query.zid
nxt = request.query.next
url = "https://zapier.com/hooks/catch/n/" .. zid .. "/"
http.request {
url = url,
method = "POST",
headers = {
View WP HN Comment.php
<?php
$code = "XXXX";
$u = urlencode(get_permalink());
$t = urlencode(get_post()->post_title);
$next = "http://news.ycombinator.com/submitlink?u=".$u."&t=".$t;
$next = urlencode($next);
$href = "http://zapier.webscript.io/click?next=" . $next . "&zid=" . $code;
?>
<a class="hn" href="<?php echo $href; ?>">Upvote and Comment on Hacker News</a>
@mikeknoop
mikeknoop / gist:4729620
Created Feb 7, 2013
Install elasticsearch on Ubuntu 10.04 lucid
View gist:4729620
cd ~
sudo apt-get update
sudo apt-get install curl python-software-properties -y
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin -y
curl -L http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.2.tar.gz | tar -xz
sudo mv elasticsearch-* /usr/local/share/elasticsearch
View gist:3962749
<html>
<head>
<style type="text/css">
body{background-color:#f4f9fa}
.centered{text-align:center}
.container{border:1px solid #e2e2e2;width:750px;margin:50px auto}
.header{height:170px;background-color:#fbfdfd;padding-top:50px;}
.header h1{font: bold 130% Arial, Helvetica, sans-serif;
color:#5278af;margin:0;padding:0}
.header h2{font: bold 80% Tahoma, Verdana, sans-serif;
View gist:3948931
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
$fields = array('data' => $variable);
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt(CURLOPT_HTTPHEADER, array('Content-Type' => 'application/json'));
curl_setopt(CURLOPT_POST, true);
curl_setopt(CURLOPT_POSTFIELDS, $fields );
View gist:3202651
#
# core
from 'log' import log
from 'jquery' import $
from 'underscore' import _
from 'backbone' import Backbone
from 'handlebars' import Handlebars
# iterator: use to truthy-test filter function to iterate over a backbone collection, only rendered those
# which pass the truthy-test
View gist:3147976
appDir: "", # path relative to baseUrl where the app lives. Our app lives at the baseUrl so this is blank
baseUrl: "../../src/", # app path relative to the location of THIS build profile file.
dir: "../../build", # directory to put all the files in while build is happening (it shouldn't exist before build)
mainConfigFile: 'main.js', # make sure this matches the module below
modules: [
{
name: "main" # presumes your app config is in a file called main.js
}
]
View gist:2934489
require.config(
baseUrl: '/static/js/src',
paths:
app: 'app',
backbone: '../external/backbone/0.9.2/backbone',
backboneanalytics:'../external/backbone/analytics/0.0.2/backboneAnalytics'
backbonecache: 'backbone/cache/backboneCache', # coffee compiled
cookie: '../external/jquery/cookie/1.0.0/cookie',
error: 'error/error', # coffee compiled
escapesel: '../external/jquery/escapeSel/1.0.0/escapeSel',
@mikeknoop
mikeknoop / examples.js
Created Mar 21, 2012 — forked from bryanhelmig/examples.js
EmailPie Samples
View examples.js
// An invalid domain.
// http://emailpie.com/v1/check?email=notreal@example.com
{
"didyoumean": null,
"errors": [
{
"message": "No MX records found for the domain.",
"severity": 7
}
You can’t perform that action at this time.