Skip to content

Instantly share code, notes, and snippets.

View Hates's full-sized avatar

Richard Hart Hates

View GitHub Profile
@Hates
Hates / alacritty_dracula.yml
Last active December 13, 2018 02:02
Alacritty Dracula Theme
# Add this to your alacritty.yml file.
# Colors (Dracula)
colors:
# Default colors
primary:
background: '0x282a36'
foreground: '0xf8f8f2'
# Normal colors

Keybase proof

I hereby claim:

  • I am Hates on github.
  • I am hates_ (https://keybase.io/hates_) on keybase.
  • I have a public key whose fingerprint is F0E6 3AE4 C385 1BFC D399 DC74 447E 69E7 5FCC 1227

To claim this, I am signing this object:

@Hates
Hates / en.yml
Last active August 29, 2015 14:27
en:
karma:
admin: "admin title"
level_-1: "title1"
level_0: "title2"
level_50: "title3"
match "foo/bar", to: redirect('/oof/%{name}')
match "oof/:action", controller: "some"
def hashtag_finder(text)
text.split.collect { |s| s.starts_with?("#") ? build_link(s): s }.join(" ")
end
def build_link(matched)
"<span class='darkredlink'>#{link_to matched, search_path(:q => matched)}</span>"
end
<% if @user.errors.any? %>
$("#edit-user-form").html("<%= escape_javascript(render('fields_edit', f: @user)) %>");
<% else %>
$("#user-profile").html("<%= escape_javascript(render('profile')) %>");
<% end %>
class Story < ActiveRecord::Base
has_many :story_keywords, order: "score DESC", dependent: :destroy
has_many :keywords, through: :story_keywords, order: "story_keywords.score DESC"
def keywords
super.merge(StoryKeyword.stanford)
end
end
source "https://rubygems.org"
gem 'rails', '~> 4.0.11'
gem "rails-observers", "~> 0.1.2"
gem "pg"
gem 'redis', '~> 3.1.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.4'
@Hates
Hates / paypal_controller_decorator.rb
Created November 6, 2014 18:41
app/controllers/spree/paypal_controller_decorator.rb
Spree::PaypalController.class_eval do
def express
order = current_order || raise(ActiveRecord::RecordNotFound)
items = order.line_items.map(&method(:line_item))
additional_adjustments = order.all_adjustments.additional
tax_adjustments = additional_adjustments.tax
shipping_adjustments = additional_adjustments.shipping
GET media-development/media/_mapping
{
"media-development": {
"mappings": {
"media": {
"properties": {
"authors": {
"type": "string",
"fields": {
"raw": {