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 / 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
@amirrajan
amirrajan / Rakefile.rb
Created November 15, 2012 22:33
asp.net mvc https
desc 'creates an initial dev.yml file for, this file is needed if you want to run an asp.net mvc app using IISExpress'
task :init_dev_yml do
File.open("dev.yml", 'w') { |f| f.write("database: (local)\\sqlexpress\niisexpress: C:\\Program Files (x86)\\IIS Express") }
end
task :server do
if dev_yml_exists
start_iis_express_with_config "applicationHost.config"
else
puts "it doesn't look like dev.yml exists on this machine. You need to have this file to run your mvc app in IIS Express, run the dev:init_dev_yml rake task to create the dev.yml. After the file is created, you'll want to inspect the file and change the default values."
@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 / keybase.md
Created March 14, 2014 23:24
keybase.md

Keybase proof

I hereby claim:

  • I am amirrajan on github.
  • I am amirrajan (https://keybase.io/amirrajan) on keybase.
  • I have a public key whose fingerprint is 8FA4 ABD0 205D 8D25 9968 B351 BFF8 BFD1 3CC1 47F7

To claim this, I am signing this object:

@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 / Cli.fsx
Last active August 10, 2018 15:47
FSharpData Quick Start for OSX
#load "References.fsx"
open System
open Microsoft.FSharp.Reflection
open Nessos.UnionArgParser
let fromString<'a> s =
match FSharpType.GetUnionCases typeof<'a> |> Array.filter (fun case -> case.Name = s) with
| [|case|] -> FSharpValue.MakeUnion(case,[||]) :?> 'a
| _ -> failwith <| sprintf "Can't convert %s to DU" s
(def five-by-five [[:. :. :. :. :.]
[:. :. :. :. :.]
[:. :. :. :. :.]
[:. :. :. :. :.]
[:. :. :. :. :.]])
(defn to-coordinates [board]
(into []
(flatten
(map-indexed