Skip to content

Instantly share code, notes, and snippets.

View paul-english's full-sized avatar

Paul English paul-english

View GitHub Profile
{% wire id="more-results" action={moreresults result=result target="list-articles" template="_article_summary.tpl"} %}
<p style="display:none;"><a href="javascript:void(0);" id="more-results">More results...</a></p>
<script>
$(function() {
// PE - this is all a hack, anyone know a better way to do this?
var firedOnce = false;
$(document).scroll(function(e) {
if ($(window).scrollTop() >= $(document).height() - $(window).height() - 200) {
// helper function that goes inside your socket connection
client.connectSession = function(fn) {
var cookie = client.request.headers.cookie;
var sid = unescape(cookie.match(/connect\.sid=([^;]+)/)[1]);
redis.get(sid, function(err, data) {
fn(err, JSON.parse(data));
});
};
// usage
function cdls {
cd $1;
ls;
}
alias cd=cdls
// Firstleft build script ~nrub
//
// 1) installs all necessary node libraries
// 2) copies conf files to appropriate etc directories
// 3) restarts running application server
// 4) runs tests
var run = require('run').run;
var npmPackages = [
@paul-english
paul-english / kill-cr.sh
Created February 2, 2011 21:19
Kills carriage returns for all PHP files in current directory
for f in `find . -type f -name '*.php' -print`; do mv $f ${f}~ && tr -d "\r" < ${f}~ >$f; rm ${f}~; done;
var http = require('http');
http.createServer(function(request, response) {
var proxy = http.createClient(80, 'google.com');
var url = request.url;
console.log(url);
@paul-english
paul-english / zoo-items-frontpage.sql
Created March 1, 2011 17:05
Set all Zoo Items to frontpage
INSERT INTO jos_zoo_category_item (category_id, item_id)
SELECT 0, id FROM jos_zoo_item
UPDATE customer_entity_int SET value =123 WHERE attribute_id =925
@paul-english
paul-english / org-supr-automation.el
Created March 23, 2011 20:47
Use org-mode & ttytter to post to twitter
(add-hook 'org-clock-in-hook
(lambda ()
(when (string-match "^tweet" org-clock-heading)
(message
(shell-command-to-string (concat
"ttytter -status='"
(replace-regexp-in-string "^tweet " "" org-clock-heading)
"'"))))))
@paul-english
paul-english / gist:1119132
Created August 1, 2011 22:18
API Snippet
<linearlayout orientation="vertical" width="100%" height="100%">
<tabview width="100%" height="50%">
<tab label="Tab 1">
<linearlayout orientation="vertical" width="100%" height="100%">
<image src="http://example.com/image.png" width="50" height="80"/>
<image src="http://example.com/image.png" width="200" height="80"/>
</linearlayout>
</tab>
<tab label="Tab 2" icon="http://example.com/icon.png">
<linearlayout orientation="vertical" width="100%" height="100%">