Skip to content

Instantly share code, notes, and snippets.

var a = "false";
a = Boolean(a);
console.log(a); // -> true || WTF?
@janmonschke
janmonschke / formhelper.coffee
Created May 12, 2011 13:25
Simple FormHelper that works well with Backbone.js Models
###
Helps creating and submitting forms
- easy labeling
- automatically inserts values of the model to the form
- is able to serialize forms to JSON
- can submit the form to the server
- automatically displays errors if there are any
###
class FormHelper
@janmonschke
janmonschke / map.js
Created May 31, 2011 11:09
Backbone couch connector blogpost v0.1
// ddoc/byCollection/map.js
function(doc) {
if(doc.collection){
emit(doc.collection, doc);
}
}
@janmonschke
janmonschke / smarttv-debugging-server.js
Created February 20, 2013 02:24
A simple debugging server for the Samsung SmartTV platform. Simply start the server and then connect your machine to the TV and it'll print out (and save) everything the TV sends
var net = require('net');
var fs = require('fs');
// file name for the current log
var fileName = __dirname + '/log_' + new Date().getTime();
// Start a TCP Server
var server = net.createServer(function (socket) {
// Log what the TV sends
myApp = angular.module 'myApp', []
# encapsulates ajax stuff
myApp.factory 'myService', ($http, $rootScope) ->
data = { test: 123 }
url = 'http://192.168.2.4:8080/'
# doesn't do anything, no request in the server logs
postItNormal = ->
$http.post url, data
@janmonschke
janmonschke / index.ios.js
Created February 4, 2016 12:53
ListTest
import React, {
AppRegistry,
Component,
StyleSheet,
Text,
View,
ListView,
RecyclerViewBackedScrollView
} from 'react-native';
@janmonschke
janmonschke / machine.js
Last active October 16, 2019 13:42
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions