Skip to content

Instantly share code, notes, and snippets.

View salmangadit's full-sized avatar

Salman Gadit salmangadit

  • Microsoft
  • Silicon Valley
View GitHub Profile
@fwielstra
fwielstra / api.js
Created June 14, 2011 14:46
An example NodeJS / Mongoose / Express application based on their respective tutorials
/* The API controller
Exports 3 methods:
* post - Creates a new thread
* list - Returns a list of threads
* show - Displays a thread and its posts
*/
var Thread = require('../models/thread.js');
var Post = require('../models/post.js');
@sourcec0de
sourcec0de / install_nodejsV0.10.9.sh
Last active November 15, 2018 08:44
A Rock solid nodejs platform install script. Latest Redis, MongoDB, and NodeJS V10.9.0 tested Ubuntu 13.04 X64
#!/bin/sh
# Add MongoDB Package
echo "Add MongoDB Package"
echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" >> /etc/apt/sources.list
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
echo "MongoDB Package completed"
# Update System
echo "System Update"
@travisnewby
travisnewby / CMDeviceMotion.swift
Last active November 12, 2022 17:13
Determine the direction of "gaze" of the device in any orientation
extension CMDeviceMotion {
func gaze(atOrientation orientation: UIInterfaceOrientation) -> SCNVector4 {
let attitude = self.attitude.quaternion
let aq = GLKQuaternionMake(Float(attitude.x), Float(attitude.y), Float(attitude.z), Float(attitude.w))
let final: SCNVector4
switch orientation {