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
| def self.stupid_arrange | |
| arranged = ActiveSupport::OrderedHash.new | |
| self.sorted.where(depth: 0).each do |item| | |
| arranged[item] = [] | |
| end | |
| self.sorted.where(depth: 1).each do |item| | |
| if key = arranged.find{ |k, _| k.id == 54 }.first | |
| arranged[key].push(item) | |
| 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
| set nocompatible | |
| filetype off | |
| set rtp+=~/.vim/bundle/vundle/ | |
| call vundle#rc() | |
| Bundle 'gmarik/vundle' | |
| Bundle 'scrooloose/nerdtree' | |
| Bundle 'tpope/vim-commentary' | |
| Bundle 'scrooloose/nerdcommenter' |
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
| SirTrevor.Blocks.Gallery = do -> | |
| SirTrevor.Block.extend | |
| _initialized: no | |
| initializeUploader: -> | |
| return if @_initialized | |
| @uploader = @getTextBlock().find('@uploader') | |
| @uploader.fileupload ((-> | |
| debugger | |
| url: '/photos.json' | |
| type: 'PATCH' |
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
| # Show how much RAM application uses. | |
| # $ ram safari | |
| # # => safari uses 154.69 MBs of RAM. | |
| function ram() { | |
| local sum | |
| local items | |
| local app="$1" | |
| if [ -z "$app" ]; then | |
| echo "First argument - pattern to grep from processes" |
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
| O <ПрайсЛистЮx128kb>x27yyjpli/x27>>x27k>>i<x27aКодЮx128kb>x27ea</Код> x27i<Цена>x27ea</Цена>x27a x27i<СтараяЦенаЮx128kb>x27ea</Саx128kbтараяЦенаЮx128kb>x27a <Склад>x27A</Склад>x27Vkkk<>>x27jjjj^j |
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
| # ─$ ruby -v | |
| # ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0] | |
| require 'json' | |
| require 'digest/md5' | |
| api_token = 'ololo' | |
| json = '{ "signature": "55b47124341b5bed8627499b0eb5de80", "marker": "%marker%", "host": "%server_host%", "user_ip": "%user_ip_address%", "locale": "ru", "trip_class": "Y", "passengers": { "z": 123, "adults": "1", "children": "0", "infants": "0" }, "segments": [ { "z": 123, "origin": "MOW", "destination": "LED", "date": "2015-05-25" }, { "origin": "LED", "destination": "MOW", "date": "2015-06-18" } ] }' | |
| params = JSON.parse(json).sort.to_h |
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
| last_id = 42 | |
| User.destroy_all "id > #{last_id}" | |
| require 'csv' | |
| file = "#{Rails.root}/users.csv" | |
| passwords = {} | |
| rate = Rate.find_by_name('Unlimited') | |
| (1..200).each do |i| |
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
| [user] | |
| name = Roma Milushov | |
| email = [email protected] | |
| [giggle] | |
| main-window-maximized = true | |
| main-window-geometry = 0x0+0+0 | |
| history-view-vpane-position = 304 | |
| file-view-vpane-position = 386 | |
| main-window-view = HistoryView | |
| [color] |
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 'csv' | |
| options = { | |
| write_headers: true, | |
| headers: ['first_name', 'last_name', 'email', 'phone', 'purchased_courses'], | |
| } | |
| CSV.open("#{Rails.root}/users-for-unisender.csv", 'w', options) do |writer| | |
| User.find_each do |u| |
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
| time = Time.parse('Tue, 03 Feb 2015 22:32:11 MSK +03:00') | |
| _begin = time.beginning_of_day | |
| _end = time.end_of_day | |
| target = '/tmp/5k_promos_3_4_2015.txt' | |
| File.open(target, "w+") do |f| | |
| Promocode.where(['generated_at >= ?', _begin]).where(['generated_at <= ?', _end]).each do |promo| | |
| f.puts(promo.code) | |
| end | |
| end |