Skip to content

Instantly share code, notes, and snippets.

@evnm
evnm / gist:31e4c5e4d37fb477b15c
Created Mar 10, 2015
A little script to generate new Scala+Maven projects
View gist:31e4c5e4d37fb477b15c
#! /bin/sh
#
# A little script to generate new Scala+Maven projects.
set -e
if test $# -lt 1; then
echo "usage: $0 <project name>"
exit 1
fi
@evnm
evnm / cred-proc-meat.js
Created Oct 20, 2010
Express and dropbox-node preliminaries
View cred-proc-meat.js
access_token = token_res['token'],
access_token_secret = token_res['secret'],
dropbox = new DropboxClient(oauth,
access_token,
access_token_secret);
res.redirect('/file_browser');
@evnm
evnm / app-final.js
Created Oct 21, 2010
Final implementation of a simple Dropbox file browser.
View app-final.js
var sys = require('sys'),
http = require('http'),
OAuth = require('oauth').OAuth,
DropboxClient = require('dropbox').DropboxClient,
express = require('express'),
app = express.createServer();
// Initialize OAuth object.
var API_URI = 'http://api.dropbox.com/',
API_VERSION = '0',
@evnm
evnm / npm-cache-clean-bug.txt
Created Nov 17, 2010
Possible bug in npm cache clean
View npm-cache-clean-bug.txt
$ npm cache ls
npm info it worked if it ends with ok
npm info using npm@0.2.8-1
npm info using node@v0.2.4
npm info cache nothing found
npm ok
$ npm cache add dropbox 0.1.0
npm info it worked if it ends with ok
npm info using npm@0.2.8-1
npm info using node@v0.2.4
@evnm
evnm / app-session-final.js
Created Dec 8, 2010
Final implementation of a simple Dropbox file browser (with session support).
View app-session-final.js
var sys = require('sys'),
http = require('http'),
OAuth = require('oauth').OAuth,
DropboxClient = require('dropbox').DropboxClient,
express = require('express'),
app = express.createServer();
// Initialize OAuth object.
var API_URI = 'http://api.dropbox.com/',
API_VERSION = '0',
@evnm
evnm / app-configure-block.js
Created Dec 8, 2010
Add cookie and session support to Dropbox file browser example.
View app-configure-block.js
app.configure(function() {
app.use(express.logger());
app.use(express.bodyDecoder());
app.use(express.cookieDecoder()); // Cookie-decoding.
app.use(express.session()); // Session-handling.
});
@evnm
evnm / file-browser-with-dropbox-node-0.2.0.js
Created Jan 11, 2011
Updated version of file browser demo using dropbox-node v0.2.0.
View file-browser-with-dropbox-node-0.2.0.js
var sys = require('sys')
, DropboxClient = require('dropbox').DropboxClient
, express = require('express')
, app = express.createServer()
, consumer_key = '85m56oj9a6ekr1k'
, consumer_secret = 'kirag26pr0pbf3z'
app.configure(function () {
app.use(express.logger())
app.use(express.bodyDecoder())
View dropbox-node-0.2.0-example.js
dropbox.getAccessToken(email, password, function (err) {
if (err) return console.error('Error: ' + err)
dropbox.getAccountInfo(function (err, data) {
if (err) return console.error('Error: ' + err)
console.log(data.display_name + ', ' + data.email)
})
})
View rename-file-and-buffer.el
;; Originally from stevey, adapted to support moving to a new directory.
;; http://stackoverflow.com/questions/384284/can-i-rename-an-open-file-in-emacs
(defun rename-file-and-buffer (new-name)
"Renames both current buffer and file it's visiting to NEW-NAME."
(interactive
(progn
(if (not (buffer-file-name))
(error "Buffer '%s' is not visiting a file!" (buffer-name)))
(list (read-file-name (format "Rename %s to: " (file-name-nondirectory
(buffer-file-name)))))))
@evnm
evnm / gist:1143421
Created Aug 13, 2011
My new screensaver
View gist:1143421
yes 123482736951872309587349057348056239146823756892376589237469236759034285709238470192384723975634895763894567981234902042387509324875093246709126374093476509137649023187409213865092386549034137849127340983729084172309487129037490182374901823740981273094817239041234740213 | lolcat