Skip to content

Instantly share code, notes, and snippets.

View olivierlacan's full-sized avatar

Olivier Lacan olivierlacan

View GitHub Profile
@nicolashery
nicolashery / solarized-dark.css
Last active March 25, 2022 08:38 — forked from scotu/solarized.css
Solarized theme stylesheets for Jekyll and Pygments
/* Solarized Dark
For use with Jekyll and Pygments
http://ethanschoonover.com/solarized
SOLARIZED HEX ROLE
--------- -------- ------------------------------------------
base03 #002b36 background
base01 #586e75 comments / secondary content

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@olivierlacan
olivierlacan / gist:5608432
Created May 19, 2013 18:00
Rails 4 doesn't like Bundler's binstubs. This is what happens when you upgrade to Rails 4 RC1 with Bundler binstubs installed.
Looks like your app's ./bin/rails is a stub that was generated by Bundler.
In Rails 4, your app's bin/ directory contains executables that are versioned
like any other source code, rather than stubs that are generated on demand.
Here's how to upgrade:
bundle config --delete bin # Turn off Bundler's stub generator
rake rails:update:bin # Use the new Rails 4 executables
git add bin # Add bin/ to source control
@courtenay
courtenay / STDOUT
Last active December 16, 2015 15:19
add the "<a name" and span icon there as well, so you can style it with a cute little hoverable link
# output
> gh = Redcarpet::Render::GithubStyleTitles.new
> puts Redcarpet::Markdown.new(gh).render "test\n\n# test 1\n\n# test 2\n\n# test 1\n\n# test 1"
=>
<a name="test-1" class="anchor" href="#test-1"><span class="anchor-icon"></span></a><h1 id="test-1">test 1</h1>
<a name="test-2" class="anchor" href="#test-2"><span class="anchor-icon"></span></a><h1 id="test-2">test 2</h1>
@nbibler
nbibler / gist:5307941
Last active October 7, 2021 09:38
A .powrc file which works with RVM's .rvmrc or .ruby-version (+ .ruby-gemset) configuration files.
if [ -f "$rvm_path/scripts/rvm" ]; then
source "$rvm_path/scripts/rvm"
if [ -f ".rvmrc" ]; then
source ".rvmrc"
fi
if [ -f ".ruby-version" ]; then
rvm use `cat .ruby-version`
fi
@jswanner
jswanner / migrate.rake
Last active April 1, 2021 22:05
Rolls back migrations in current branch not present in specified branch.
desc 'rolls back migrations in current branch not present in other'
task :rollback_branch_migrations, [:other_branch] do |t, args|
load "#{Dir.pwd}/Rakefile"
branch_migrations = BranchMigrations.new(args.other_branch)
puts ['Rollback the following migrations', branch_migrations, 'y,n? ']
next if %w[no n NO N].include?(STDIN.gets.chomp)
Rake::Task['environment'].invoke
@yooosef
yooosef / UVSummit_2013.md
Last active December 15, 2015 06:39
UserVoice Summit 2013

Richard White: The Future of Customer Care & UserVoice 2.0

  • 363 people see a UV widget every second, 9+ million a month
  • Another UserConf SF in October 2013
  • Customer retention is the new acquisition: Former thinking was customer acquisition was important (LivingSocial, GroupOn). Subscription based economy you have to keep them coming back each month.
  • Service is part of your product, cannot be separate. Best service is service that is integrated into your product.
  • Customer portal is dead, the app is where your users are.
  • Proactively solicit input from users.
  • Focus your customer engagement around meaningful engagement
  • Meaningful engagement needs meaningful analytics
  • New product: 1. Instant Answers. 2. Satisfaction Scores. An expanded feedback tool. A single bedrock metric for analyzing customer satisfaction. 3. SmartVote. Improves upon the forum. 35 times more users engaged vs. the traditional UV feedback forum. Twice more feedback per user. Engagement per user is much higher.
@parndt
parndt / gist:4660837
Last active December 11, 2015 21:09
Devise multi-patcher
# config/initializers/devise_patch.rb
require 'devise/version'
if !defined?(Devise::VERSION) || (Devise::VERSION < "1.4.0" && %w[1.2 1.3].all? {|v| !Devise::VERSION.start_with?(v)})
raise "I don't know how to patch your devise version. See http://blog.plataformatec.com.br/2013/01/security-announcement-devise-v2-2-3-v2-1-3-v2-0-5-and-v1-5-3-released/"
end
if Devise::VERSION < "1.5.0"
warn "Patching devise #{Devise::VERSION} with < 1.5.0 patch"
Devise::Models::Authenticatable::ClassMethods.class_eval do
def auth_param_requires_string_conversion?(value); true; end
@olivierlacan
olivierlacan / 1_poltergeist_flash.rb
Last active December 11, 2015 16:59
Poltergeist has a neat but unintuitive way of returning cookies from `page.driver.cookies` or `Capybara.current_session.driver.cookies`, here's how you get them to play nice with assertions in RSpec integration specs using Capybara for example.
module PoltergeistFlash
module TestHelpers
def flash_cookie
cookie = CGI.unescape Capybara.current_session.driver.cookies["flash"].value
return {} unless cookie
JSON.parse(cookie).with_indifferent_access
rescue JSON::ParserError
{}
end
end
@sdball
sdball / sandi_metz_rules_for_developers.md
Created January 18, 2013 18:47
Rules for good development from Sandi Metz

Sandi Metz’ rules for developers

  1. Your class can be no longer than a hundred lines of code.
  2. Your methods can be no longer than five lines of code
  3. You can pass no more than four parameters and you can't just make it one big hash.
  4. In your controller, you can only instantiate one object, to do whatever it is that needs to be done.
  5. Your view can only know about one instance variable.
  6. Your Rails view should only send messages to that object i.e., no Demeter violations.[ "thunder dome principal". Translated: one model in, one model out! ]
  7. Rules are meant to be broken if by breaking them you produce better code. [ ...where "better code" is validated by explaining why you want to break the rule to someone else. ]