Skip to content

Instantly share code, notes, and snippets.

@sagacity
sagacity / createFrom.js
Created October 22, 2010 12:48
Creates a knockout viewmodel from a regular object
/*
Usage:
var viewModel = createFrom(regularObject);
To update the viewmodel:
viewModel.updateFrom(newRegularObject);
*/
var createFrom = function(source, destination, isNested) {
if (!destination) destination = {};
@sagacity
sagacity / JsonMessageSerializer.cs
Created October 25, 2010 12:57
JSON.NET Message Serializer for aspComet
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AspComet;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace Teletrax.Common.Web.Comet
{
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script src="http://knockoutjs.com/js/jquery.tmpl.js" type="text/javascript"></script>
<script src="http://knockoutjs.com/js/knockout-latest.js" type="text/javascript"></script>
</head>
<body>
<script type="text/javascript">
$(document).ready(function() {
@sagacity
sagacity / Program.cs
Created November 13, 2012 16:49
M3U to Spotify tracks
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Web;
@sagacity
sagacity / main.rs
Created July 25, 2017 15:46
A draft of the weld component system
use std::collections::HashMap;
use std::rc::Rc;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
struct Component {
events: HashMap<Event, Box<StateCallback>>,
children: Vec<Component>,
}
@sagacity
sagacity / docker-compose.yml
Created November 9, 2022 15:54
Prometheus behind Nginx with CORS enabled
version: '2'
services:
prometheus:
container_name: prometheus
image: bitnami/prometheus:latest
volumes:
- ./prometheus.yml:/opt/bitnami/prometheus/conf/prometheus.yml
ports:
- "9090:9090"