$ ruby treetoar.rb
SELECT "topics".* FROM "topics" WHERE "topics"."id" = 1
Topic.where(id: 1)
SELECT "topics".* FROM "topics" WHERE "topics"."id" IN (1, 2, 3)
Topic.where(id: [1, 2, 3])
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
ABILITY = { | |
simple_user => { | |
can => %w[name], | |
cannot => %w[type], | |
} | |
} |
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
export DISPLAY=localhost:1.0 | |
XVFB=/usr/bin/Xvfb | |
XVFBARGS=":1 -screen 0 1024x768x24 -ac +extension GLX +render -noreset" | |
PIDFILE=/var/run/xvfb.pid | |
case "$1" in | |
start) | |
echo -n "Starting virtual X frame buffer: Xvfb" | |
start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS | |
echo "." | |
;; |
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
# https://gist.github.com/rilian/e89d9dbc096f56ebcb1d | |
# | |
# Custom rspec matcher for testing CanCan abilities. | |
# Originally inspired by https://github.com/ryanb/cancan/wiki/Testing-Abilities | |
# | |
# Usage: | |
# expect.to have_abilities(:create).on(Post.new) | |
# expect.to have_abilities([:read, :update].on(post) | |
# expect.to have_abilities({manage: false, destroy: true}.on(post) | |
# expect.to have_abilities({create: false}.on(Post.new) |
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
# | |
# In git project folder run | |
# git log > log.txt | |
# | |
# then | |
# ruby git_work_by_day.rb | |
# | |
# Sample result: | |
# | |
# Fri Feb 20 => Mike Smith, Bob Jones |
$ free -m
total used free shared buffers cached
Mem: 490 482 7 13 3 55
-/+ buffers/cache: 423 66
Swap: 0 0 0
$ sudo dd if=/dev/zero of=/swapfile bs=32M count=16
16+0 records in
16+0 records out
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
CREATE FUNCTION batch_at_will() RETURNS INTEGER LANGUAGE plpgsql AS $$ | |
DECLARE batched_count INTEGER = 1; | |
BEGIN | |
WITH selected_users AS ( | |
SELECT id | |
FROM users | |
WHERE role = 'moderator' | |
AND registration_date < CURRENT_DATE - INTERVAL '4' YEAR | |
LIMIT 1000 | |
FOR UPDATE NOWAIT |
A non-exhaustive list of flux and flux-like libraries with relevant information and notes.
Library | Stars | Latest Release |
---|---|---|
Facebook flux | ||
reflux | ||
fluxxor | ||
marty | [ |
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
Привет {member_name} | |
Мы начали выступление в Пентатлоне достаточно хорошо, но могли бы еще лучше! | |
В марафоне - POGS - мы держимся на 16 месте и возможно выйдем на 15 через несколько дней http://www.seti-germany.de/boinc_pentathlon/statistiken/challenge.php?challengeid=1 | |
Сегодня стартовал новый этап - Rosetta@home, который продлится до 13 мая, тут наша команда традиционно сильна, и поэтому мы вышли в первый день сразу на 11 место http://www.seti-germany.de/boinc_pentathlon/statistiken/challenge.php?challengeid=3 | |
В общем зачете это позволило нам набрать очков и подняться до 13 места! http://www.seti-germany.de/boinc_pentathlon/statistiken/pentathlon.php |
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
# ... | |
gem 'redis' |
OlderNewer