This file contains 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 DateScopes | |
extend ActiveSupport::Concern | |
module ClassMethods | |
def define_date_scopes(*scope_columns) | |
scope_columns.map(&:to_s).each do |column| | |
match_data = column.match(/^(.*)_at$/) | |
name = match_data ? match_data[1] : column |
This file contains 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
load 'deploy' | |
# Uncomment if you are using Rails' asset pipeline | |
load 'deploy/assets' | |
load 'config/deploy' # remove this line to skip loading any of the default tasks |
This file contains 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
// XPath CheatSheet | |
// To test XPath in your Chrome Debugger: $x('/html/body') | |
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/ | |
// 0. XPath Examples. | |
// More: http://xpath.alephzarro.com/content/cheatsheet.html | |
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class |
This file contains 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
# make_dump(){ | |
# now=$(date +"%Y%m%d") | |
# pg_dump -Fc -U deployer -w mercury_production -f ~/manual_dumps/mercury_sa_$now.dump | |
# } | |
_pg_restore(){ | |
if [[ -z $1 ]]; then | |
echo Database is not specified | |
return 0 | |
fi |
This file contains 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
require 'axlsx' | |
require 'batch_factory' | |
def off_balance?(count) | |
!(count =~ /^0\d\d/).nil? || !(count =~ /^\D/).nil? | |
end | |
keys = [:code, :name, :sub1, :sub2, :sub3] | |
skk = BatchFactory.from_file('skk.xlsx', keys: keys).drop(1) |
This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.
###Array ####Definition:
- Stores data elements based on an sequential, most commonly 0 based, index.
- Based on tuples from set theory.
This file contains 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
require 'dry-struct' | |
module Types | |
include Dry::Types.module | |
end | |
class Button < Dry::Struct | |
attribute :text, Types::String | |
end |
This file contains 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 | |
ffmpeg \ | |
-protocol_whitelist file,udp,rtp -i sdp.test \ | |
-c:v libx264 -c:a aac \ | |
-y test.mp4 | |
# ffmpeg \ | |
# -protocol_whitelist file,rtp,udp -i sdp.test \ |
- OUT: Join
{request: "join", room: 1234, ptype: "publisher", display: "a"}
Создается participant (с типом publisher) и добавляется в комнату.
g_hash_table_insert(videoroom->participants, janus_uint64_dup(publisher->user_id), publisher);
OlderNewer