class FileUploadPolicy < ApplicationPolicy
def create?
can_create = false
FileUploadPolicy.creator_roles.each do |role|
can_create = can_create || @user.send("#{role}?".to_sym)
end
can_create
end
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"clinicHours": { | |
"Monday": { | |
"wake_up": ["08:00"], | |
"sleep": ["12:00"] | |
}, | |
"Tuesday": { | |
"wake_up": ["08:00"], | |
"sleep": ["12:00"] | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew install mysql #install mysql using home brew | |
mysql_install_db --verbose --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp | |
mkdir -p ~/Library/LaunchAgents | |
cp /usr/local/Cellar/mysql/<mysql dist version you have>/<the plist file you have in this dir>.plist ~/Library/LaunchAgents/ | |
launchctl load -w ~/Library/LaunchAgents/<the plist file you have in this dir>.plist | |
#try | |
mysql -uroot; #if it works: yayyyy !!! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT DISTINCT(each_attribute ->> 'reference_number_field') | |
AS reference_number | |
FROM deliveries | |
CROSS JOIN json_array_elements(reference_numbers) | |
AS each_attribute | |
WHERE (each_attribute -> 'reference_number_field') | |
IS NOT NULL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
if ! grep -q xenial /etc/lsb-release | |
then | |
echo "Adding PPA for up-to-date Node.js runtime. Give your password when asked." | |
# sudo add-apt-repository ppa:chris-lea/node.js | |
sudo add-apt-repository ppa:chris-lea/redis-server | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from_cte_sql = ::Namespace::From.where_clause | |
# .. | |
from_table = Arel::Table.new(:from_lane) | |
to_table = Arel::Table.new(:to_lane) | |
rates_table = Arel::Table.new(:rates) | |
rates_table | |
.join(from_table).on(rates_table[:from_id].eq(from_table[:id])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ConcurrentExecutor | |
class Error < StandardError | |
def initialize(exceptions) | |
@exceptions = exceptions | |
super | |
end | |
def message | |
@exceptions.map { | e | e.message }.join "\n" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: binary -*- | |
# This is the process manager of Unicorn. This manages worker | |
# processes which in turn handle the I/O and application process. | |
# Listener sockets are started in the master process and shared with | |
# forked worker children. | |
# | |
# Users do not need to know the internals of this class, but reading the | |
# {source}[https://bogomips.org/unicorn.git/tree/lib/unicorn/http_server.rb] | |
# is education for programmers wishing to learn how unicorn works. |
OlderNewer