Skip to content

Instantly share code, notes, and snippets.

View nsanta's full-sized avatar

Nicolas Santa nsanta

  • Rio Cuarto, Cordoba, Argentina
View GitHub Profile
@nsanta
nsanta / three.coffee
Created November 2, 2012 00:10
angular timeline blog post gists three
#app is the variable that contains the module “AwesomeApp”
app.controller ‘SessionCtrl’, ($scope, $location, Session) →
$scope.login = →
Session.save $scope.session , (response) →
$location.path “/dashboard”
@nsanta
nsanta / two.coffee
Created November 2, 2012 00:10
angular timeline blog post gists two
app = angular.module(‘AwesomeApp’, [‘ngResource’]).
.config [‘$routeProvider’, ($route) →
$route.when(‘/sessions’, {
controller: SessionCtrl,
templateUrl: ‘/app/templates/sessions/login.html’
})
@nsanta
nsanta / one.coffee
Created November 2, 2012 00:09
angular timeline blog post gists one
# Session is a resource
@SessionCtrl = ($scope, $location, Session) →
$scope.login = →
Session.save $scope.session , (response) →
$location.path “/dashboard”
@nsanta
nsanta / four.coffee
Created November 1, 2012 23:49
angular timeline blog post gists
app = angular.module(‘AwesomeApp’, [‘ngResource’]).
.config [‘$routeProvider’, ($route) →
$route.when(‘/sessions’, {
controller: ‘SessionCtrl’, # replace the controller function by the controller name
templateUrl: ‘/app/templates/sessions/login.html’
})
@nsanta
nsanta / gist:2919007
Created June 12, 2012 17:50
Examples of "cool vs right" code
# Cool way
class Foo < ActiveRecord::Base
end
class FooCool
def intialize(conditions)
@conditions = conditions
end
nicolas@nicolas-P5K-VM:~/dev/projects/yetimedia/hubot$ heroku logs
2012-03-28T21:25:21+00:00 app[web.1]: [Wed, 28 Mar 2012 21:25:21 GMT] ERROR Streaming connection closed for room Scrums and everthing else. :(
2012-03-28T21:25:27+00:00 app[web.1]: [Wed, 28 Mar 2012 21:25:27 GMT] ERROR Campfire error on room Scrums and everthing else: Access Denied Token or room not found
2012-03-28T21:25:27+00:00 app[web.1]: [Wed, 28 Mar 2012 21:25:27 GMT] ERROR Streaming connection closed for room Scrums and everthing else. :(
2012-03-28T21:25:33+00:00 app[web.1]: [Wed, 28 Mar 2012 21:25:33 GMT] ERROR Campfire error on room Scrums and everthing else: Access Denied Token or room not found
2012-03-28T21:25:33+00:00 app[web.1]: [Wed, 28 Mar 2012 21:25:33 GMT] ERROR Streaming connection closed for room Scrums and everthing else. :(
2012-03-28T21:25:38+00:00 app[web.1]: [Wed, 28 Mar 2012 21:25:38 GMT] ERROR Campfire error on room Scrums and everthing else: Access Denied Token or room not found
2012-03-28T21:25:38+00:00 app[web.1]
@nsanta
nsanta / gist:1666307
Created January 23, 2012 23:18
image upload form
<form action="javascript:void(0)" method="POST" enctype="multipart/form-data" id="product_image_upload_form">
<input name="product_id" ,="" type="hidden" value="1">
<div class="row">
<span class="span16">
<label>Image</label>
<input name="images" ,="" type="file" value="">
</span>
</div>
<div class="row">
<span class="span16">
implementacion
def sino
yield ? 'si : 'no'
end
uso
Using prawn (0.12.0)
Using rmagick (2.13.1)
Using prawn-fast-png (0.2.3)
Using rails (3.0.10)
Using prawn_rails (0.0.7)
Using query_reviewer (0.1.3) from git://github.com/nesquena/query_reviewer.git (at master)
Using raindrops (0.8.0)
Using rb-fsevent (0.4.3.1)
Using rcov (0.9.11)
#user nobody;
worker_processes 2;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;