Skip to content

Instantly share code, notes, and snippets.

Avatar

Bertrand Chardon Veejay

View GitHub Profile
@Veejay
Veejay / script_vm.js
Created Jul 11, 2012
Script VireMoi
View script_vm.js
// ==UserScript==
// @name Script VireMoi
// @description Met des bouton pour virer ou garder, mais virer c'est mieux hein
// @namespace rien
// @include http://flickr.com/photos/*
// @include http://www.flickr.com/photos/*
// ==/UserScript==
(function() {
View test.html.haml
- if total > 0 && actual_or_estimated_hours == :actual_hours
- css_class = "actuals"
%li{:class => css_class, :style => "height: #{total}px"}
%span=total
- else
- css_class = ""
- total = work_weeks_for_date.map { |ww| ww.send(:estimated_hours) || 0 }.inject(:+) || 0
- mozilla_gradient = "background-image: -moz-linear-gradient(to bottom, #5E9B69 #{percentage}%, #7EBA8D 0%)"
- webkit_gradient = "background-image: -webkit-linear-gradient(top, #5E9B69 #{percentage}%, #7EBA8D 0%)"
- inline_style = ";#{mozilla_gradient};#{webkit_gradient}"
View gist:2854803
{foo: 24, bar: 34, bang: 45, moo: 56}
AND
[:foo, :moo, :bang, :bar]
==> {foo: 24, moo: 56, bang: 45, bar: 34}
View foo.rb
- content_for(:stylesheet_includes) do
= stylesheet_link_tag('staffplans')
%section
.user-header
%header
= link_to("Add Staff", new_user_path)
= render :partial => "shared/date_switcher", :locals => { :date_range => @date_range, :type => :staffplan }
%ul.users
View foo.rb
def info_and_controls
content_tag :li, :class => (project.proposed? ? "proposed" : "") do
link_to model do
content_tag :span, model.client.try(:name) || "N/A", :class => "client-name"
content_tag :span, model.name, :class => "project-name"
content_tag :span, model.proposed? ? "Proposed" : ""
end
content_tag :div, :class => "controls" do
link_to "Edit", edit_project_path(model)
end
View foo.rb
%li{:class => project.proposed? ? "proposed" : ""}
= link_to project do
%span.client-name= project.client.try(:name) || "N/A"
%span.project-name= project.name
%span.proposed= "(Proposed)" if project.proposed?
.controls
= link_to t('.edit'), edit_project_path(project)
View gist:2830864
%li{:class => project.proposed? ? "proposed" : ""}
= link_to project do
%span.client-name= project.client.try(:name) || "N/A"
%span.project-name= project.name
%span.proposed= "(Proposed)" if project.proposed?
.controls
= link_to t('.edit'), edit_project_path(project)
View gist:2821215
staffplan/ $ JRUBY_OPTS="-Xcext.enabled=true" bundle exec rspec [14:03:45 (staffplan-tests-cleanup!!!) ]
zsh: correct 'rspec' to 'spec' [nyae]? n
LoadError: load error: pg_ext -- java.lang.UnsatisfiedLinkError: failed to load shim library, error: dlopen(/Users/bertrand/.rvm/rubies/jruby-head/lib/native/Darwin/libjruby-cext.dylib, 10): image not found
require at org/jruby/RubyKernel.java:991
require at /Users/bertrand/.rvm/gems/jruby-head/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251
load_dependency at /Users/bertrand/.rvm/gems/jruby-head/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:236
require at /Users/bertrand/.rvm/gems/jruby-head/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251
(root) at /Users/bertrand/.rvm/gems/jruby-head/gems/pg-0.13.2/lib/pg.rb:4
require at org/jruby/RubyKernel.java:991
(
View braces_do_end.rb
1.9.3p194 :023 > p [1,2,3,4].inject do |memo, element|
1.9.3p194 :024 > memo += element;memo
1.9.3p194 :025?> end
LocalJumpError: no block given
1.9.3p194 :026 > p [1,2,3,4].inject{|memo, element| memo+=element; memo}
10
=> 10
View o_O.rb
1.9.3p0 :005 > def o_O s
1.9.3p0 :006?> puts s.upcase
1.9.3p0 :007?> end
=> nil
1.9.3p0 :008 > o_O "WHUT???"
WHUT???
=> nil
1.9.3p0 :009 >
You can’t perform that action at this time.