Skip to content

Instantly share code, notes, and snippets.

View some1else's full-sized avatar

Srđan Prodanović some1else

View GitHub Profile
@some1else
some1else / application.html.erb
Last active March 1, 2024 12:36
Vite & Rails: App layout for development & production
<!DOCTYPE html>
<html>
<head>
<title><%= request.host %></title>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%- unless ENV['index_js'].present? and ENV['index_css'].present?
Dir.glob("public/static/js/*.js").each do |file_path|
@some1else
some1else / deliverize.sh
Created March 1, 2024 11:58
Vite & Rails: Build, commit & deploy
#!/bin/sh
start_time=$(date +%s)
trap 'end_time=$(date +%s); echo "\n *** Completed in: $((end_time - start_time)) seconds\n"' EXIT
echo "\033[35m\n *** Build & deploy to production\n\033[0m"
# Guards
cd app-frontend

Keybase proof

I hereby claim:

  • I am some1else on github.
  • I am some1else (https://keybase.io/some1else) on keybase.
  • I have a public key ASCb_P_uA3882AjVcsGXLBU8PUatwAJD1OGcOSEZsqJdago

To claim this, I am signing this object:

@some1else
some1else / protostate.jsx
Last active December 18, 2016 13:36
Using Class.prototype.state for default initial state.
class App extends React.Component {
startWondering = (e) => {
this.setState({ feeling: 'wondering' })
}
render() {
const { feeling } = this.state
const { feeling: initialFeeling } = this.__proto__.state

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
class Project < AR::B
has_many :comments, :as => :commentable
end
class Comment < AR::B
belongs_to :commentable
end
- form_for :project do |project_form|
/ fields_for :comment doesn't work :-S
- project_form.fields_for :comment_attributes do |comment_form|