Skip to content

Instantly share code, notes, and snippets.

Per Ejeklint ejeklint

Block or report user

Report or block ejeklint

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View asyncimages.swift
final class Loader: BindableObject {
let didChange = PassthroughSubject<Data?, Never>()
var task: URLSessionDataTask!
var data: Data? = nil {
didSet {
didChange.send(data)
}
}
init(_ url: URL) {
@nnarhinen
nnarhinen / server.js
Last active Dec 21, 2015
Automatically keep your backbone models up-to-date via web sockets by listening to couchdb changes feed
View server.js
var db = new (require('cradle').Connection)().database('my_db');
db.info(function(err, result) {
var seq = result.update_seq;
db.changes({since: seq, include_docs: true}).on('change', function(change) {
if (change.doc && change.doc.owner) {
io.sockets.in(change.doc.owner).emit('change:' + change.doc.type, decorate(change.doc));
}
});
});
View node_couchdb.md

Hi, all.

Encouraged by my successful experiment with a Node.js view server, I am now working on a branch, nodejs_couchdb, with the following properties:

  • Remove couchjs from the project
  • Remove dependency on SpiderMonkey, libjs, 1.8.whatever...all that is gone
  • Remove dependency on libcurl
  • (Thus, simplified autoconf version dependency Hell)

Phase 1: Dependency on a "couchjs" executable which you install via npm install couchjs

View notifications.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>notifications</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
$(function () {
if (window.webkitNotifications) {
console.log('Notifications are supported!');
@jed
jed / LICENSE.txt
Created May 17, 2011 — forked from 140bytes/LICENSE.txt
publish/subscribe, or pubsub
View LICENSE.txt
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@basham
basham / nodejs-rfid.js
Last active Oct 16, 2019
Use NodeJS to read RFID ids through the USB serial stream.
View nodejs-rfid.js
/*
DESCRIPTION
-----------
Use NodeJS to read RFID ids through the USB serial stream. Code derived from this forum:
http://groups.google.com/group/nodejs/browse_thread/thread/e2b071b6a70a6eb1/086ec7fcb5036699
CODE REPOSITORY
---------------
https://gist.github.com/806605
You can’t perform that action at this time.