Skip to content

Instantly share code, notes, and snippets.

View jcrugzz's full-sized avatar

Jarrett Cruger jcrugzz

View GitHub Profile
@max-mapper
max-mapper / helloworld.js
Created November 27, 2012 06:55
droneduino
var serialport = require('node-serialport')
var sp = new serialport.SerialPort("/dev/ttyO3", {
parser: serialport.parsers.raw,
baud: 9600
})
sp.on('data', function(chunk) {
console.log(chunk.toString('hex'), chunk.toString(), chunk)
})

Overview

PouchDB is a database written in JavaScript for web browsers that has in built sync capabilities.

For a long time 'web' was synonymous with 'online'. That is no longer the case, Mobile web usage is set to overtake desktop web usage shortly and a growing number of examples are showing that web technology is capable of handling the type of applications that were traditionally built using desktop native technology.

The new wave of offline web applications are going to need somewhere to store their data and they are going to need to learn how to move that data around as their user moves from device to device. How about we build a database with that functionality built in?

Objective

/* WebRTC consist of a few moving pieces
- A signal mechanism for peers
- A signal mechanism to send offers & answers
- A simplified peerConnection function
*/
var uuid = require("node-uuid")
, assert = require("assert")

In other words, the following asynchronous code:

var d = Domain.create()

d.on("error", function (error) {
    console.error("Error with the twitterverse:", error)
})

d.enter()
@max-mapper
max-mapper / Websocket.java
Created September 7, 2012 21:42
android websocket wss:// plugin (not done)
package com.phonegap.plugins.websocket;
import android.os.Bundle;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.apache.cordova.api.Plugin;
import org.apache.cordova.api.PluginResult;
import java.net.URI;
@aleksi-niiranen
aleksi-niiranen / SomeActivity.java
Created July 9, 2012 19:11
Loading view popup in Android
public class SomeActivity extends Activity {
// make it a field so we can dismiss it when the activity pauses.
// otherwise the window will leak and cause and exception when the activity no longer exists
private PopupWindow mPopup;
public void showPopup() {
View popupView = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.indeterminate_progress, null);
Display display = getWindowManager().getDefaultDisplay();
// getWidth() and getHeight() are deprecated and we should use getSize() but it's available on API level 13 and up
mPopup = new PopupWindow(popupView, display.getWidth(), display.getHeight());
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 9, 2024 10:41
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@isaacsanders
isaacsanders / Equity.md
Created January 21, 2012 15:32
Joel Spolsky on Equity for Startups

This is a post by Joel Spolsky. The original post is linked at the bottom.

This is such a common question here and elsewhere that I will attempt to write the world's most canonical answer to this question. Hopefully in the future when someone on answers.onstartups asks how to split up the ownership of their new company, you can simply point to this answer.

The most important principle: Fairness, and the perception of fairness, is much more valuable than owning a large stake. Almost everything that can go wrong in a startup will go wrong, and one of the biggest things that can go wrong is huge, angry, shouting matches between the founders as to who worked harder, who owns more, whose idea was it anyway, etc. That is why I would always rather split a new company 50-50 with a friend than insist on owning 60% because "it was my idea," or because "I was more experienced" or anything else. Why? Because if I split the company 60-40, the company is going to fail when we argue ourselves to death. And if you ju

@mbostock
mbostock / .block
Last active November 22, 2022 23:32
Line Transition
license: gpl-3.0
@simme
simme / Install_tmux
Created October 19, 2011 07:55
Install and configure tmux on Mac OS X
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using Terminal.app (iTerm has mouse support)
Install http://www.culater.net/software/SIMBL/SIMBL.php
Then install https://bitheap.org/mouseterm/
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/