Ilya Levin Almaron

View Guardfile
1 2 3 4 5 6 7 8 9 10
guard 'livereload' do
watch(%r{app/views/.+\.(erb|haml|slim)$})
watch(%r{app/helpers/.+\.rb})
watch(%r{public/.+\.(css|js|html)})
watch(%r{config/locales/.+\.yml})
# Rails Assets Pipeline
watch(%r{(app|vendor)(/assets/\w+/(.+\.(css|js|html))).*}) { |m| "/assets/#{m[3]}" }
end
 
guard 'rails' do
View Gemfile
1 2 3 4 5 6 7 8 9 10
group :development, :test do
gem "rspec-rails"
gem 'rb-inotify', '~> 0.9'
gem "factory_girl_rails"
gem "capybara"
gem "guard-rspec"
gem "guard-rails"
gem "guard-livereload"
gem "rack-livereload"
end
View gist:7140302
1 2 3 4 5 6 7 8 9
//The HTML setup
 
<div ng-init="loadPhotos" ng-controller="PhotosCtrl" class="main_wrap"></div>
 
//The controller
 
PhotosCtrl = ($scope, $resource) ->
 
AllPhotos = $resource("/photos",{})
View import_photos.js.coffee
1 2 3 4 5 6 7 8 9 10
@ModelsCtrl = ($scope, $resource) ->
//resource
Import = $resource("/models/:model_id/import_photos",{model_id: '@model_id'},{push: {method: "POST", isArray:true}})
 
//function
$scope.importPhotos = (url) ->
photos = Import.push({model_id: $scope.model.id, url: url}, ->
$scope.model.photos.concat(photos)
)
$scope.import = {}
View gist:7137624
1 2 3 4 5 6 7 8 9 10
 
$scope.importPhotos = function(url) {
var photos;
photos = Import.push({
model_id: $scope.model.id,
url: url
}, function() {
$scope.photos.concat(photos);
});
$scope["import"] = {};
View _photo.html.erb
1 2 3 4 5 6 7 8 9 10
<div class="one_photo" ng-repeat="photo in model.photos" >
<div class="delete_link">
<a ng-click="removePhoto(photo)">x</a>
</div>
<a class="fancy_gallery" href="{{photo.url}}" rel="gallery">
<img src="{{photo.thumb}}">
</a>
<div class="under_link">
<a href="/models/{{photo.model_id}}">{{photo.model_id}}</a>
</div>
View models_app.js.coffee
1 2 3 4 5 6 7 8
app = angular.module("ModelsApp",["ngResource"])
 
@ModelsCtrl = ($scope, $resource) ->
Model = $resource("/models/:id",{id: "@id"},{update: {method: "PUT"}})
 
$scope.model = Model.get({id: $scope.model_id})
 
#$scope.model_id comes in empty
View show.json.jbuilder
1 2 3 4
json.comments @model.comments do |comment|
json.(comment,:id, :model_id, :comment)
json.create_date I18n.l(comment.created_at)
end
View gist:7005595
1 2 3 4 5
for($i=1; $i<=3; $i++) {
echo "set ";
}
 
3.times {puts "set"}
View bootstrap_custom.css.scss
1 2 3 4
$font-family-base: Arial;
$font-family-sans-serif: Arial;
 
@import 'bootstrap';
Something went wrong with that request. Please try again.