Skip to content

Instantly share code, notes, and snippets.

View danielnegri's full-sized avatar
Coffee first.

Daniel Negri danielnegri

Coffee first.
View GitHub Profile
@danielnegri
danielnegri / factorial.rb
Created June 2, 2012 17:46 — forked from bitops/factorial.rb
Factorial in Ruby 1.9.2
def factorial(n)
(1..n).reduce(:*)
end
@danielnegri
danielnegri / playdeb.sh
Created August 10, 2012 01:35 — forked from stefanbirkner/playdeb.sh
Playdeb builds a debian package of the play framework.
#!/bin/bash
# playdeb builds a debian package of the play framework. playdeb downloads
# the playframework by itself. You run it by
# playdeb.sh <version> <maintainer>
# Example:
# playdeb.sh 1.2.3 "Denny Colt <d.colt@eisner.qcg>"
#
# The script has been tested with version 1.2.3.
if [ -z $1 ]
@danielnegri
danielnegri / devise.coffee
Created August 22, 2012 01:39 — forked from dgb/devise.coffee
Twitter Bootstrap styles for Devise
$ ->
$('.close').live 'click', (e) ->
e.preventDefault()
$(this).parent().hide()
$('.devise form div i').each ->
$this = $(this)
text = $this.text()
sibling = $this.prev('label')
a = $("<a>").text("*").attr('title', text)
a.prependTo(sibling)
@danielnegri
danielnegri / app.js
Created September 21, 2012 12:58 — forked from joemaffia/app.js
foursquare OAuth in Titanium
/**
*
*
* Copyright 2011 Aaron K. Saunders, Clearly Innovative Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>
import dispatch._
import Http._
import scala.xml._
var http = new Http()
var tweets = XML.loadString(http("http://twitter.com/statuses/user_timeline.xml?screen_name=tommorris" as_str))
(tweets \\ "status" \ "text").toList.foreach(x => println(x.text))
#!/usr/bin/env ruby
# Aside from removing Ruby on Rails specific code this is taken verbatim from
# mislav's git-deploy (http://github.com/mislav/git-deploy) and it's awesome
# - Ryan Florence (http://ryanflorence.com)
#
# Install this hook to a remote repository with a working tree, when you push
# to it, this hook will reset the head so the files are updated
if ENV['GIT_DIR'] == '.'

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discussions around concrete examples, not handy-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

#!/usr/bin/env ruby
require 'bundler'
gems = ARGV
if gems.empty?
puts "Updating all gems"
Bundler.definition(true)
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
# NEW WAY / EASY WAY
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.0.deb
sudo dpkg -i elasticsearch-0.90.0.deb

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation