Skip to content

Instantly share code, notes, and snippets.

View califa's full-sized avatar
🙃
joel

Joel Califa califa

🙃
joel
View GitHub Profile
@califa
califa / _form.html.erb
Created May 8, 2011 20:53
LMS Ruby Project
<%= error_messages_for(@user) %>
<table summary="User form fields">
<% if @page_title == 'Create User' %>
<tr>
<th><%= f.label(:type, "User Type") %></th>
<td><%= f.select(:type, ["Admin", "Teacher", "User"]) %></td>
</tr>
<% end %>
<tr>
@califa
califa / user.rb
Created May 8, 2011 23:56
Capitalize call
class User < ActiveRecord::Base
attr_accessor :password
EMAIL_REGEX = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i
validates :first_name, :presence => true, :length => { :maximum => 50 }
validates :last_name, :presence => true, :length => { :maximum => 50 }
validates :email, :presence => true, :length => { :maximum => 100 },
:format => EMAIL_REGEX, :confirmation => true
@califa
califa / students_controller.rb
Created May 9, 2011 06:44
Controller with date method
class Event < Struct.new(:class, :name, :date); end
class StudentsController < ApplicationController
require 'table_builder'
require 'table_builder/calendar_helper'
layout 'dashboard'
def index
@student = Student.find(session[:user_id])
@califa
califa / dabblet.css
Created March 8, 2012 15:20
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
* { padding: 0; margin: 0 }
html, body { height: 100%; background: #171717; }
.map {
width: 100%;
@califa
califa / dabblet.css
Created March 8, 2012 15:20
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
* { padding: 0; margin: 0 }
html, body { height: 100%; background: #171717; }
.map {
width: 100%;
@califa
califa / dabblet.css
Created March 8, 2012 15:20
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
* { padding: 0; margin: 0 }
html, body { height: 100%; background: #171717; }
.map {
width: 100%;
@califa
califa / gist:4108727
Created November 19, 2012 03:03
User Form
<%= form_for @user, :validate => true do |f| %>
<%= f.label :name, "User Name" %>
<%= f.text_field :name %>
<%= f.label :email %>
<%= f.text_field :email %>
<%= f.label :password %>
blueprint:
name: Lutron Diva Extra Actions
description: |
Different Actions on Short, Long, and Double Click button presses.
There is no Double Click for up/down as those are slower to respond and produce bad experience.
domain: automation
input:
diva_id:
name: Lutron Diva
description: The Lutron Switch used to trigger the automations
li.plugin-tasks-list-item span.tasks-backlink {
color: transparent;
font-size: 0px;
}
li.plugin-tasks-list-item span.tasks-backlink > a {
content: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='15' height='15'");
background: #999;
-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='16' height='16' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M14.05 11.364a4.992 4.992 0 0 0-4.88-2.192 4.978 4.978 0 0 0-2.827 1.414L4.929 12a5 5 0 0 0 7.07 7.071l.708-.707m-2.758-5.728a4.992 4.992 0 0 0 4.88 2.192 4.978 4.978 0 0 0 2.828-1.414L19.07 12A5 5 0 0 0 12 4.929l-.707.707' /%3E%3C/svg%3E");
height: .9em;