Skip to content

Instantly share code, notes, and snippets.

@dawsontoth
dawsontoth / RecordingVideo.js
Created February 17, 2011 19:43
How to record video, then share or save it. Using Appcelerator Titanium!
/**
* This sample lets you record and share video with Appcelerator Titanium on Android.
* REQUIRES THE 1.6.0 RC OF TITANIUM MOBILE SDK
* http://developer.appcelerator.com/blog/2011/02/release-candidate-for-titanium-mobile-1-6-0.html
*/
/**
* First, create our UI. We'll have two buttons: record, and share.
*/
var win = Titanium.UI.createWindow({
@aheckmann
aheckmann / storeImgInMongoWithMongoose.js
Created April 17, 2012 19:14
store/display an image in mongodb using mongoose/express
/**
* Module dependencies
*/
var express = require('express');
var fs = require('fs');
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
// img path
@Mithrandir0x
Mithrandir0x / gist:3639232
Created September 5, 2012 16:15
Difference between Service, Factory and Provider in AngularJS
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
@fantasywind
fantasywind / Gruntfile.js for yo angular with jade and stylus
Last active August 29, 2015 13:56
Please install contrib first: npm install grunt-contrib-jade -D;npm install grunt-contrib-stylus -D;npm install;
// Generated on 2014-02-05 using generator-angular 0.7.1
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
module.exports = function (grunt) {
Array.prototype.filter = Array.prototype.filter
|| function (fn) {
var item;
var clone = this.slice();
var done = {};
clone.push(done);
while ((item = clone.shift()) !== done) {
if (fn(item)) clone.push(item);
}
return clone;
@mildred
mildred / howto_nat_traversal.md
Last active December 9, 2023 06:59
How To TCP NAT Traversal using Node.js and a STUN Server

How To TCP NAT Traversal using Node.js and a STUN Server

With the scarecity of IPv4 addresses, and IPv6 still not available at large, NAT traversal is becoming a necessity. Especially with the generalisation of Carrier-grade NATs that you can find on mobile connections. Even with IPv6 you may suffer NAT66. Imagine your mobile device that gets only a single Ipv6 address, and you want to share it on your computer.

The solution might be in a decentralized protocol for address attribution such

@staltz
staltz / introrx.md
Last active May 20, 2024 14:59
The introduction to Reactive Programming you've been missing
require "formula"
class Mongodb < Formula
homepage "http://www.mongodb.org/"
url "http://downloads.mongodb.org/src/mongodb-src-r2.6.3.tar.gz"
sha1 "226ab45e3a2e4d4a749271f1bce393ea8358d3dd"
bottle do
sha1 "d573717ca7c67455680a6823de210c940faf9ac6" => :mavericks
sha1 "f7d2a0711e3ac09fd61bcb243360c1a07fb83233" => :mountain_lion
@kopipejst
kopipejst / migrate.js
Created August 24, 2014 01:07
loopback create build-in models tables
/**
* loopback: create build-in models tables
*
* put migrate.js file in server folder
* run `node migrate.js`
* @type {[type]}
*/
var app = require('./server');
var dataSource = app.dataSources.db;
{
"swagger": 2,
"info": {
"title": "天品時光膠囊 API",
"description": "Tianping Time capsule API",
"version": "1.0.0"
},
"host": "tianping.test.rytass.com",
"schemes": [
"http"