Skip to content

Instantly share code, notes, and snippets.

View amirrajan's full-sized avatar
💭
Working on DragonRuby Game Toolkit and RubyMotion

Amir Rajan amirrajan

💭
Working on DragonRuby Game Toolkit and RubyMotion
View GitHub Profile
@amirrajan
amirrajan / uitests.sh
Created April 6, 2014 19:54
ui automation command
instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate /Users/amir/Projects/a-dark-room/build/iPhoneSimulator-7.0-Development/A\ Dark\ Room.app -e UIASCRIPT automation_script.js -e UIARESULTSPATH automation_results
@amirrajan
amirrajan / automation_script.js
Last active August 29, 2015 13:58
canopy ios
#import "canopy.js"
cacheControls();
verifyText('notclicked', "Not Clicked");
tap("clickme");
verifyText('notclicked', "Clicked");
@amirrajan
amirrajan / lenses.scala
Last active August 29, 2015 14:06
Lenses, Scalaz and Scala
val firstEventL = Lens.lensu[EventContainer, Event](
(container, value) => container.copy(events = Seq(value) ++ container.events.tail), _.events.head)
val profileL = Lens.lensu[Event, Profile](
(event, value) => event.copy(profile = value), _.profile)
val reservationL = Lens.lensu[Profile, Reservation](
(profile, value) => profile.copy(reservation = value), _.reservation)
val settingAllProperties =
@amirrajan
amirrajan / animatedgif.js
Created September 12, 2015 18:45
Get an animated gif randomly given a search term
var argv = require('yargs').argv;
console.log(argv);
var rest = require('unirest').get("https://ajax.googleapis.com/ajax/services/search/images?q=" + argv.q + "&v=1.0&safe=active&rsz=8&imgtype=animated");
var _ = require('underscore');
rest.end(function(data) {
var images = _.sortBy(
JSON.parse(data.body).responseData.results,
function() { return Math.random() })[0];
@amirrajan
amirrajan / attach.vb
Created October 25, 2011 21:07
attach to iis process
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports EnvDTE90a
Imports EnvDTE100
Imports System.Diagnostics
Public Module AttachToIIS
(def five-by-five [[:. :. :. :. :.]
[:. :. :. :. :.]
[:. :. :. :. :.]
[:. :. :. :. :.]
[:. :. :. :. :.]])
(defn to-coordinates [board]
(into []
(flatten
(map-indexed
def class MainThreadRunnable < Runnable
def initialize(room_activity)
@room_activity = room_activity
end
def run
@room_activity.update_core
end
end
import Box2D.Collision.*;// bounding box of our world
import Box2D.Common.Math.*;// for vector(define gravity)
import Box2D.Dynamics.*;// define bodies and define world
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;// define our shapes
import flash.display.*;// sprite class
const MAX_STEER_ANGLE:Number = Math.PI/3;
const STEER_SPEED = 1.5;
const SIDEWAYS_FRICTION_FORCE:Number = 10;
@amirrajan
amirrajan / stuff.markdown
Last active December 24, 2015 14:59
Language observations, subject to change.

#So you want to learn another language?

Hurray! Someone sent you here or you found this some how! Here are my tips for learning a new language.

##Disclaimer

This text is a work in progress, please comment and contribute as you see fit. These are my opinons on language progression based on personal experience, not hard fast rules. If you have any tips to help others please share in the comments or fork this gist and add your own opinions.

##Here is a list of languages

@amirrajan
amirrajan / Program.cs
Last active January 1, 2016 21:07
NSpec Program.cs
using NSpec;
using NSpec.Domain;
using NSpec.Domain.Formatters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using FluentAssertions;