BACKGROUND: I'm on edge Rails (4.1.0.rc1). Users has many Communities through CommunityUser model. The following users belong to various communities:
USERS TABLE
ID | COMMUNITY_IDS
---|--------------
1 | [2, 7, 8]
2 | [3, 4, 8]
3 | [4, 5, 7]
require 'spreadsheet' | |
class DailyOrdersXlsFactory | |
#formats: | |
@@simple_format = Spreadsheet::Format.new :color => :black, :weight => :normal, :size => 10 | |
@@title_format = Spreadsheet::Format.new :color => :black, :weight => :bold, :size => 14, :vertical_align => :center, :horizontal_align => :center | |
@@total_format = Spreadsheet::Format.new :color => :black, :weight => :bold, :vertical_align => :center, :horizontal_align => :right | |
@@price_format = Spreadsheet::Format.new :color => :black, :vertical_align => :center, :horizontal_align => :center | |
@@price_title_format = Spreadsheet::Format.new :color => :black, :vertical_align => :center, :horizontal_align => :right, :weight => :bold |
class Test | |
require_relative 'test_suite' | |
include TestSuite | |
def test_true | |
assert_true([].size == 0) | |
end | |
def test_eq | |
assert_equal([].size, 0) |
class CreatePrices < ActiveRecord::Migration | |
def change | |
create_table :prices do |t| | |
t.integer :price | |
t.integer :old_price | |
t.string :name | |
end | |
end | |
end | |
----------------------------------------------- |
function pop_console() { | |
document.getElementsByTagName("body")[0].innerHTML='<div id="popconsole" style="width: 100%; height: 130px; z-index: 10000; text-size: 10px; font-family: monospace; color: white; overflow: scroll; opacity: 0.5; position: fixed; bottom: 0px; left: 0px; background: rgb(3, 10, 41);"></div>'+document.getElementsByTagName("body")[0].innerHTML; | |
} | |
var console = {}; | |
var console_counter = 100; | |
console.log = function(text){ | |
console_counter = console_counter + 1; | |
document.getElementById('popconsole').innerHTML = document.getElementById('popconsole').innerHTML + "<br/><font style='color: green'>"+console_counter+"> </font>" + text; | |
} | |
console.info = function(text){ |
# EXPORT VARIABLES | |
export PROJECTS_PATH=~/dev/current | |
export MASTER_PROJECT_NAME=ultimate-proto | |
export MASTER_PROJECT_PATH=$PROJECTS_PATH/$MASTER_PROJECT_NAME | |
# STARTUP ALIASES | |
cd $MASTER_PROJECT_PATH | |
################## | |
# PROJECT BACKUPER: |
echo "HELLO FROM GITHUB!" |
[vitalyp]:~/dev/current/ultimate-proto on develop_prototype_listing* | |
$ irb | |
2.1.2 :001 > require 'zlib' | |
=> true | |
2.1.2 :002 > crc32 = Zlib::crc32('input field value') | |
=> 1873826587 | |
2.1.2 :003 > crc32 = Zlib::crc32('input field ') | |
=> 1511246425 | |
2.1.2 :004 > crc32 = Zlib::crc32('a') | |
=> 3904355907 |
################################################################## | |
# Koding awesome Rails-script (c). Append it to your .bashrc file, in home directory. | |
# To start rails server manually you need to enable rvm initially: | |
# /bin/bash --login | |
# Then, navigate you Rails project directory, and start app server: | |
# cd ~/Applications/projectPath; | |
# rvm gemset use projectRvm; | |
# rails server -b 0.0.0.0 | |
# Lets automize this process! | |
################################################################## |
#!/usr/bin/python | |
# | |
# Copyright (C) 2012 Itzik Kotler | |
# | |
# scraper.py is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# scraper.py is distributed in the hope that it will be useful, |