Skip to content

Instantly share code, notes, and snippets.

View ejeklint's full-sized avatar

Per Ejeklint ejeklint

View GitHub Profile
@damienklinnert
damienklinnert / notifications.html
Created July 13, 2012 08:52
a simple test for html notifications from html5rocks at http://www.html5rocks.com/en/tutorials/notifications/quick/
<!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!');

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

@nnarhinen
nnarhinen / server.js
Last active December 21, 2015 22:19
Automatically keep your backbone models up-to-date via web sockets by listening to couchdb changes feed
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));
}
});
});
final class Loader: BindableObject {
let didChange = PassthroughSubject<Data?, Never>()
var task: URLSessionDataTask!
var data: Data? = nil {
didSet {
didChange.send(data)
}
}
init(_ url: URL) {
import SwiftUI
import PlaygroundSupport
// constants
let cardWidth: CGFloat = 343
let cardHeight: CGFloat = 212
let spacing = 36
let animation = Animation.spring()
let cardColors = [
Color(UIColor.systemRed),
@jed
jed / LICENSE.txt
Created May 17, 2011 06:33 — forked from 140bytes/LICENSE.txt
publish/subscribe, or pubsub
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 July 17, 2023 04:06
Use NodeJS to read RFID ids through the USB serial stream.
/*
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