Skip to content

Instantly share code, notes, and snippets.

View robksawyer's full-sized avatar
🎯
Focusing

Rob Sawyer robksawyer

🎯
Focusing
View GitHub Profile
using UnityEngine;
using System.Collections;
public class Spectrum : MonoBehaviour
{
public int numOfSamples = 8192; //Min: 64, Max: 8192
public AudioSource aSource;
@robksawyer
robksawyer / DodecahedronGalaxy.py
Created May 15, 2015 21:53
Dodecahedron Galaxy
import bpy
from bpy import context
from math import sin, cos, radians
primitive_add = bpy.ops.mesh.primitive_solid_add
# get cursor loc - Script Modified by SardiPax
cursor = context.scene.cursor_location
radialdist = 2.0
module.exports = function (grunt) {
grunt.registerTask('compileAssets', [
'clean:dev',
'bower:dev',
'jst:dev',
'less:dev',
'copy:dev',
'copy:bower', //Added
'remove:bower', //Added
'coffee:dev'
/**
* Remove files and folders.
*
* ---------------------------------------------------------------
*
* This grunt task is configured to remove the contents that aren't needed in the .tmp/public of your
* sails project. This is mostly to fix bower component issues.
*
* For usage docs see:
* https://www.npmjs.com/package/grunt-remove
/**
* Copy files and folders.
*
* ---------------------------------------------------------------
*
* # dev task config
* Copies all directories and files, exept coffescript and less fiels, from the sails
* assets folder into the .tmp/public directory.
*
* # build task config
module.exports = function(grunt) {
grunt.config.set('bower', {
dev: {
dest: '.tmp/public',
js_dest: '.tmp/public/js',
css_dest: '.tmp/public/styles'
}
});
@robksawyer
robksawyer / createZip.js
Created May 28, 2015 19:32
A helper NodeJS method that zips up a locally hosted file.
/**
*
* Converts a file into a zip file.
* More details:
* https://github.com/cthackers/adm-zip/wiki/ADM-ZIP-Introduction
* @param filename: string - The target zip filename to use
* @param targetPathWithFilename: string - Must include the file path and name e.g. /home/me/some_picture.png
* @param destPathWithFilename: string - Must include the destination file path and name e.g. /home/me/mynew.zip
* @param comment: string - Something funny
* @return RSVP promise
@robksawyer
robksawyer / promise_error.js
Created June 1, 2015 06:37
Promise troubles
createZipAndUploadToS3
.then(
function(fileData){
return uploader.createFileRecord(req.user.id, fileStream, fileData);
}
)
.then(
function(fileRecord){
return amazon.createSQSWorkQueue(req.user.id, req.param('name'), settings.aws_s3_render_bucket);
}
uploader.createZipAndUploadToS3(fileStream, settings.aws_s3_project_bucket).then(
function(fileData){
sails.log('Promised fullfilled.');
sails.log.info(fileData);
//Create the file record to store details about the file
uploader.createFileRecord(req.user.id, fileStream, fileData).then(
function(fileRecord){
sails.log('File record saved.');
sails.log(fileRecord.id);
@robksawyer
robksawyer / AuthorizationService.js
Last active August 29, 2015 14:24
A policy that checks various controllers to see if the user accessing is the actual owner.
/**
* Authorization Service
*
* Handles various validating various items regarding whether or not a User is allowed to access parts of the app.
*
*/
var changeCase = require('change-case');
module.exports = {