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
| numbers = `curl https://gist.githubusercontent.com/gor-sg/6e8296dcc76200fc59ea81b97bb0c2f2/raw/7d8d83baef7a29a4ea86e5bc70aa7c4535758c9f/gistfile1.txt`.split | |
| numbers.each {|n| Inventory.create(survey_number: n, inventory_snapshot_id: 1, created_at: Date.yesterday)} |
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
| # frozen_string_literal: true | |
| module CustomFlatten | |
| def self.included(base) | |
| base.class_eval do | |
| alias_method :old_flatten, :flatten | |
| end | |
| end | |
| def flatten |
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
| n = 22; m = 2; (1..n).select(&:odd?).each{ |i| p (" " * ((n - 1)/2 - i/2) + "x" * i) }; m.times{ |x| p (' ' * ((n - 1)/2) + 'x') } | |
| " x" | |
| " xxx" | |
| " xxxxx" | |
| " xxxxxxx" | |
| " xxxxxxxxx" | |
| " xxxxxxxxxxx" | |
| " xxxxxxxxxxxxx" | |
| " xxxxxxxxxxxxxxx" | |
| " xxxxxxxxxxxxxxxxx" |
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
| var page = require('webpage').create(), | |
| address; | |
| if (phantom.args.length != 1) { | |
| console.log('Usage: preview.js URL filename'); | |
| phantom.exit(); | |
| } else { | |
| address = phantom.args[0]; | |
| //output = phantom.args[1]; |
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
| var page = require('webpage').create(); | |
| page.settings.userAgent = 'WebKit/534.46 Mobile/9A405 Safari/7534.48.3'; | |
| page.settings.viewportSize = { width: 400, height: 600 }; | |
| page.open('http://habrahabr.ru', function (status) { | |
| if (status !== 'success') { | |
| console.log('Unable to load BBC!'); | |
| phantom.exit(); | |
| } else { | |
| window.setTimeout(function () { | |
| page.clipRect = { left: 0, top: 0, width: 400, height: 600 }; |
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
| Regexps for tests | |
| (?<!#)\s([^\s]+)\.should_not | |
| expect(\1).not_to | |
| (?<!#)\s([^\s]+)\.should | |
| expect(\1).to | |
| ( +)(.+)\.should | |
| \1expect(\2).to |
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/sh | |
| PROCFILE="mysql: mysqld | |
| elasticsearch: elasticsearch --config=/usr/local/opt/elasticsearch/config/elasticsearch.yml | |
| redis: redis-server /usr/local/etc/redis.conf | |
| sidekiq: bundle exec sidekiq -C './config/sidekiq.yml' | |
| app: bundle exec rails s" | |
| ps aux | grep '[m]ysql\|[e]lasticsearch\|[r]edis\|[r]ails\|[s]idekiq\|[f]oreman' | awk '{print $2}' | xargs kill SIGTERM |
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
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
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
| require 'sidekiq/api' | |
| Sidekiq::Stats.new.queues.keys.map { |name| ::Sidekiq::Queue.new(name) }.map(&:clear) |
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
| sudo adduser pi | |
| sudo adduser pi sudo | |
| sudo apt-get install software-properties-common python g++ make | |
| sudo add-apt-repository ppa:chris-lea/node.js | |
| sudo apt-get update | |
| sudo apt-get install nodejs |
NewerOlder