Skip to content

Instantly share code, notes, and snippets.

Model.all(:fields => [...]).chunks(20) do |chunk|
keys = chunk.first.attributes.keys
chunk.each do |row|
row_keys = keys.collect{|k| row.attributes[k]}#<< Immutable error thrown
end
end
## specs/spec.opts
--colour
--loadby random
--format profile
--backtrace
## Rakefile
require 'rubygems'
## consumer.pm : tsvs_to_mysql
my $columns = join(",",@$SocialFlow::140Kit::Schema::Result::Click::imported_cols);
my $query = "LOAD DATA INFILE '$click_stream_tsv'
IGNORE INTO TABLE `clicks`
CHARACTER SET 'utf8'
($columns)";
## click.pm
sub cols {
$ rvm install ruby-1.8.7-p174
ERROR:
You passed the --clang option and clang is not in your path.
Please try again or do not use --clang.
| id | label | value | analysis_metadata_id | graph_id | curation_id |
+--------+----------------------------------------------------+-------+----------------------+----------+-------------+
| 474217 | https://www.google.com | 4 | 4 | 15 | 1 |
| 474216 | https://www.youtube.com | 10 | 4 | 15 | 1 |
| 474215 | https://www.internet.com | 7 | 4 | 15 | 1 |
| 474227 | https://www.google.com | 5 | 4 | 20 | 1 |
| 474226 | https://www.youtube.com | 16 | 4 | 20 | 1 |
| 474225 | https://www.internet.com | 3 | 4 | 20 | 1 |
## gen.rb
def all_combinations(array)
permutations = []
array.length.downto(2) do |length|
array.permutation(length).each do |perm|
permutations << perm.sort if !permutations.include?(perm.sort)
end
end
return permutations
end
function darken () {
function stringy() {
<body bgcolor="#abcdef">
function getnumber() {
var a = Math.floor(Math.random () * 10);
var b = Math.floor(Math.random () * 10);
var c = Math.floor(Math.random () * 10);
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<body>
<script type="text/javascript">
alert('#'+Math.floor(Math.random()*16777215).toString(16));
</script>
</body>
+----+------------+----------+--------+------------+------------+
| id | dataset_id | start_id | end_id | created_at | deleted_at |
+----+------------+----------+--------+------------+------------+
| 1 | 1 | 12 | 13348 | NULL | NULL |
| 2 | 1 | 107 | 13348 | NULL | NULL |
| 3 | 1 | 274 | 13348 | NULL | NULL |
| 4 | 1 | 324 | 13348 | NULL | NULL |
| 5 | 1 | 418 | 13348 | NULL | NULL |
| 6 | 1 | 422 | 13348 | NULL | NULL |
| 7 | 1 | 455 | 13348 | NULL | NULL |
#Table Friendships
+----+------------+-------------------+------------------+------------+------------+
| id | dataset_id | following_user_id | followed_user_id | created_at | deleted_at |
+----+------------+-------------------+------------------+------------+------------+
| 1 | 1 | 12 | 13348 | NULL | NULL |
| 2 | 1 | 107 | 13348 | NULL | NULL |
| 3 | 1 | 274 | 13348 | NULL | NULL |
| 4 | 1 | 324 | 13348 | NULL | NULL |
| 5 | 1 | 418 | 13348 | NULL | NULL |