Skip to content

Instantly share code, notes, and snippets.

View Szeliga's full-sized avatar

Szymon Szeliga Szeliga

View GitHub Profile
%h1 HAML
#main_wrapper
.left_column
- if @clients.any?
= render @clients
- else
No clients available
.right_column= render :partial => “menu”
<h1>PLAIN HTML</h1>
<div id="main_wrapper">
<div class="left_column">
<% if @clients.any? %>
<%= render @clients %>
<% else %>
No clients available
<% end %>
</div>
<div class="right_column">
@mixin table-base
th
text-align: center
font-weight: bold
td, th
padding: 2px
@mixin left($dist)
float: left
margin-left: $dist
MyApp::Application.routes.draw do
root :to => "frontend#index"
namespace :api do
resources :users
resources :clients
end
match 'photos/:id' => 'photos#show'
end
@Szeliga
Szeliga / gist:3532886
Created August 30, 2012 16:47
Client list bb index
class MasterCrm.Views.Organization.Index extends Backbone.View
initialize: ->
@collection = new MasterCrm.Collections.Users()
@collection.on("reset change", @render_collection, this)
@collection.on "add", @append_element, this
$.fancybox.showActivity()
@collection.fetch()
@render()
before_validation :set_default_time
def set_default_time
self.start_date ||= Time.now.beginning_of_day
self.end_date ||= Time.now.end_of_day
end
clients = Client.limit(10)
clients.each do |client|
puts client.address.postcode
end
def index
if stale?(:last_modified => @clients.maximum("updated_at"), :etag => @clients)
respond_with @clients.as_json(:methods => [:emails_count, :phones_count, :communications_count])
end
end
def show
if stale?(@client)
respond_with @client.to_json(:include => {
:emails => {:limit => 10},
def touch
@user.touch
render :json => {"status" => "touched"}
end
@Szeliga
Szeliga / .gitignore
Created October 21, 2012 16:56 — forked from bergie/.gitignore
Node.js email handling examples
config.json
reading-image.png