Skip to content

Instantly share code, notes, and snippets.

View brandon-beacher's full-sized avatar
💭
🦑

Brandon Beacher brandon-beacher

💭
🦑
View GitHub Profile
"Action","PartNumber","Manufacturer Name","Title","Short Description","Long Description","Category","Cost","List Price","Shipping","Weight","Length","Width","Height","Featured","Discontinued","Inventoried","Allow Backorder","Inventory Quantity","Inventory Threshold","Ships In Own Package","Taxable"
"Modify","RYI GET OP-614-T","Royal Industries, Inc.","1 Dozen: Melamine Oval Platter, 13-1/4""","<p>Melamine Oval Platter, 13-1/4&quot; x 9-5/8"", NSF Listed Melamine Dinnerware, Stain and scratch resistant, Priced by Dozen, Sold in full cases only, 1 dozen per case</p>","<p>Melamine Oval Platter, 13-1/4&quot; x 9-5/8&quot;<br /></p><ul><li>NSF Listed Melamine Dinnerware</li><li>Stain and scratch resistant</li><li>Priced by Dozen, Sold in full cases only</li><li>1 dozen per case</li></ul>","Dinnerware->Melamine by Royal Industries, Inc.",40.61,52.79,"Yes",11.00,14.00,10.00,8.00,"No","No","No","Yes",0.00,0.00,"No","Yes"
system.use("com.github.brandon-beacher.smart-library.com.joyent.Sammy");
system.use("com.joyent.Resource");
system.use("com.stevenlevithan.parseUri");
system.use("org.json.json2");
system.use("resources.DavFile");
system.use("resources.DavFolder");
GET("/dav-files", function () {
this.davFiles = DavFile.search({});
var DavFolder = new Resource('davFolder', {
"@save": function() {
throw "what happens if I throw during a save?";
}
});
DavFolder.root = function() {
davFolders = DavFolder.search({ parentId: null, name: "/" });
switch (davFolders.length) {
case 0:
[% INCLUDE _header.html title="DavFolders" %]
<h1>DavFolders</h1>
<p>There are [% davFolders.length %] DavFolders.</p>
[% FOREACH davFolder = davFolders %]
[% INCLUDE DavFolders/_davFolder.html davFolder=davFolder %]
[% END %]
<p>Here is the root DavFolder.</p>
[% INCLUDE DavFolders/_davfolder.html davFolder=rootFolder %]
[% INCLUDE _footer.html %]
class CreateJobs < ActiveRecord::Migration
def self.up
create_table :jobs, :force => true do |table|
table.timestamps
table.string :type, :null => false
table.integer :person_id, :null => false
table.boolean :running, :null => false, :default => true
table.text :exception, :default => nil
table.text :data
end
pretzel:local brandon$ which gem
/usr/local/bin/gem
pretzel:local brandon$ /usr/local/bin/gem -v
1.3.5
pretzel:local brandon$ gem -v
1.3.2
pretzel:local brandon$
Here's my sample data set
mysql> SELECT tf.id, tf.authorization_id_response, tf.tran_type FROM transaction_feeds tf;
+-----+---------------------------+-----------+
| id | authorization_id_response | tran_type |
+-----+---------------------------+-----------+
| 239 | 223672 | 9120 |
| 240 | 223672 | 9220 |
| 241 | 223673 | 9120 |
+-----+---------------------------+-----------+
#!/usr/bin/env narwhal
require("browser");
var dirname = require("file").path(module.path).dirname();
load(dirname + "/../lib/couch.js");
var db = new CouchDB();
db.uri = "http://localhost:5984/dfc/";
// Serialize the data to the disk
function save_data() {
- var file = new node.fs.File();
- file.open("tasks.db", "w");
- file.write(JSON.stringify(tasks));
- file.close();
+ var fd = node.fs.open("tasks.db", node.O_WRONLY, 0666).wait();
+ node.fs.write(fd, JSON.stringify(tasks)).wait();
+ node.fs.close(fd).wait();
diff --git a/src/http.js b/src/http.js
index 736fb1b..e041167 100644
--- a/src/http.js
+++ b/src/http.js
@@ -424,9 +424,16 @@ node.http.createServer = function (requestListener, options) {
//server.setOptions(options);
server.addListener("request", requestListener);
server.addListener("connection", connectionListener);
+ if (options.reload) { server.addListener("request", requestListenerForReload); };
return server;