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
var record_visit = function(req, res){ | |
/* Connect to the DB and auth */ | |
require('mongodb').connect(mongourl, function(err, conn){ | |
conn.collection('ips', function(err, coll){ | |
/* Simple object to insert: ip address and date */ | |
object_to_insert = { 'ip': req.connection.remoteAddress, 'ts': new Date() }; | |
/* Insert the object then print in response */ | |
/* Note the _id has been created */ | |
coll.insert( object_to_insert, {safe:true}, function(err){ |
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
javascript:(function({ | |
var INSTAPAPER=true,w=window,d=document,pageSelectedTxt=w.getSelection?w.getSelection():(d.getSelection)?d.getSelection():(d.selection?d.selection.createRange().text:0),pageTitle=d.title,pageUri=w.location.href,tmplt=""; | |
tmplt="From ["+pageTitle+"]("+pageUri+"):\n\n"; | |
if(pageSelectedTxt!="") { | |
pageSelectedTxt=">%20"+pageSelectedTxt; | |
pageSelectedTxt=pageSelectedTxt.replace(/(\r\n|\n+|\r)/gm,"\n"); | |
pageSelectedTxt=pageSelectedTxt.replace(/\n/g,"\n>%20\n>%20"); | |
w.location.href="nvalt://make/?txt="+encodeURIComponent(tmplt+pageSelectedTxt)+"&title="+encodeURIComponent(pageTitle) | |
} | |
else { |
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
on run {input, parameters} | |
tell application "Finder" | |
set sel to selection | |
if (count sel) > 0 then | |
set myTarget to item 1 of sel | |
else if (count window) > 0 then | |
set myTarget to target of window 1 | |
else | |
set myTarget to path to home folder | |
end if |
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
javascript:(function(){ | |
var enc=encodeURIComponent, | |
w=window, | |
frames=w.frames, | |
d=document, | |
tn=w.getSelection?w.getSelection():(d.getSelection)?d.getSelection():(d.selection?d.selection.createRange().text:0), | |
pu=w.location.href, | |
isGMail=w.location.host.match(/mail\.google\.com/), | |
tt=pt=d.title, | |
subjSpans=d.getElementsByClassName("hP"),i,url; |
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
-- Maketags | |
-- | |
-- Builds ctags file for currently active project | |
-- | |
-- Installation: | |
-- | |
-- Copy script to either location: | |
-- ~/Library/Application Support/BBEdit/Scripts | |
-- ~/Dropbox/Application Support/BBEdit/Scripts | |
-- |
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
-- accumulate all context names that contain the "wait" substring | |
repeat with anItem in (complete "wait" as context) | |
set waitingForContextNamesList to waitingForContextNamesList & {(name of anItem)} | |
end repeat | |
choose from list waitingForContextNamesList with prompt "Choose Waiting context…" OK button name "Set" cancel button name "Cancel" | |
set chosenWaitingForContext to result as string | |
set theContextID to id of item 1 of (complete chosenWaitingForContext as context) | |
-- this last line fails even if theContextID is correct | |
set theWaitingForContext to first context whose id is theContextID |
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
-- first query looks for files containing both xhadoopx and xhbasex | |
'( kMDItemTextContent == "*xhadoopx*"wc && kMDItemTextContent == "*xhbasex*"wc )' | |
-- 2nd query searches for the same files but should filter out those containing xmapreducex | |
'( kMDItemTextContent == "*xhadoopx*"wc && kMDItemTextContent == "*xhbasex*"wc && kMDItemTextContent != "-xmapreducex"wc )' | |
-- but both return the same set of results |
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
According to the Git documentation when using submodules they are recorded at the exact commit they are, but not at symbolic references as master or branch or tag. | |
Here is a scenario: | |
1. check out a submodule into master project | |
2. switch to a specific branch or tag in the submodule | |
3. add submodule to the master project | |
4. commit master project | |
Questions: |
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
javascript:(function(){var p=document.createElement("p");p.innerHTML="<strong>Loading…</strong>";p.id="loadingp";p.style.padding="20px";p.style.background="#fff";p.style.left="20px";p.style.top=0;p.style.position="fixed";p.style.zIndex="9999999";p.style.opacity=".85";document.body.appendChild(p);document.body.appendChild(document.createElement("script")).src="https://gist.github.com/al3xandru/5932700/raw/grablinks.js?x="+(Math.random());})(); |
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
javascript:(function(){var p=document.createElement("p");p.innerHTML="<strong>Loading…</strong>";p.id="loadingp";p.style.padding="20px";p.style.background="#fff";p.style.left="20px";p.style.top=0;p.style.position="fixed";p.style.zIndex="9999999";p.style.opacity=".85";document.body.appendChild(p);document.body.appendChild(document.createElement("script")).src="https://gist.github.com/al3xandru/6145492/raw/Bullseye.js?x="+(Math.random());})(); |
OlderNewer