Recipes (number) with ingredients (letter):
-
- A B
-
- B C D
-
- D
All must match:
- Query for A matches 1
- Query for B matches 1,2
- Query for C matches 2
- Query for D matches 3
# | |
# Usage: | |
# class ApplicationController < ActionController::Base | |
# include ErrorPages | |
# end | |
# | |
module ErrorPages | |
extend ActiveSupport::Concern | |
jQuery.getCachedScript = function(url, callback, options) { | |
// allow user to set any option except for dataType, cache, and url | |
options = jQuery.extend(options || {}, { | |
dataType: "script", | |
cache: true, | |
url: url, | |
complete: callback || jQuery.noop | |
}); | |
// Use jQuery.ajax() since it is more flexible than $.getScript |
# config/initializers/mysql2_dump_triggers.rb | |
module TriggerDumper | |
def structure_dump | |
super << select_all("SHOW TRIGGERS").map { |trigger| | |
exec_without_stmt("SHOW CREATE TRIGGER #{trigger['Trigger']}").first['SQL Original Statement'].sub(/DEFINER=\S+ /,'') << "\n\n" | |
}.join | |
end | |
end |
Recipes (number) with ingredients (letter):
All must match:
# (create oauth2 tokens from Google Console) | |
client_id = "" | |
client_secret = "" | |
# (paste the scope of the service you want here) | |
# e.g.: https://www.googleapis.com/auth/gan | |
scope = "" | |
class MyModel < ActiveRecord::Base | |
def to_param | |
"#{id}-#{name}".parameterize | |
end | |
end |
# | |
# Shoulda Macros for testing the robots.txt | |
# ========================================= | |
# | |
# source: https://gist.github.com/3515360 | |
# inspiration: https://github.com/fizx/robots/blob/master/lib/robots.rb | |
# license: WTFPL http://sam.zoy.org/wtfpl/ | |
# | |
# Example usage: | |
# |
de: | |
errors: | |
messages: | |
expired: "ist abgelaufen, bitte neu anfordern" | |
not_found: "nicht gefunden" | |
already_confirmed: "wurde bereits bestätigt" | |
not_locked: "ist nicht gesperrt" | |
not_saved: | |
one: "Konnte %{resource} nicht speichern: ein Fehler." | |
other: "Konnte %{resource} nicht speichern: %{count} Fehler." |
module AsyncHelper | |
extend ActiveSupport::Concern | |
module ClassMethods | |
def perform(id, method, *args) | |
find(id).send(method, *args) | |
end | |
end | |
def async(method, *args) |
# clone repo | |
svn2git http://jwebsocket.googlecode.com/svn | |
# remove unwanted files | |
git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch \ | |
jWebSocketDownloads \ | |
jWebSocketExecutables \ | |
jWebSocketRTE \ | |
jWebSocketClient/web/javadocs \ | |
jWebSocketDeployment \ |