This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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 = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setCaret: ($el) -> | |
return if _.any @NO_CARET_TYPES, (type) => return type == @model.get('type') | |
lastCaret = @getCaret() | |
caret = $el.atCaret('getCaretPosition') if $el?[0]? | |
@model.set {caret: caret, lastCaret: lastCaret} | |
$el.attr 'data-caret', caret if caret? | |
$el.attr 'data-last-caret', lastCaret if lastCaret? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setCaret: function($el) { | |
var caret, lastCaret, | |
_this = this; | |
if (_.any(this.NO_CARET_TYPES, function(type) { | |
return type === _this.model.get('type'); | |
})) { | |
return; | |
} | |
lastCaret = this.getCaret(); | |
if (($el != null ? $el[0] : void 0) != null) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Book = new Backbone.Model.extend() | |
Paginate = | |
page: 0 | |
turnPage: () -> | |
@page += 1 | |
@fetch {data: {page: @page}} | |
book = _.extend new Book(), Paginate | |
book.turnPage() |