I hereby claim:
- I am Draveness on github.
- I am draven (https://keybase.io/draven) on keybase.
- I have a public key whose fingerprint is 62CA 63CD FC29 5526 5B5E 9141 30B1 E305 0480 F92E
To claim this, I am signing this object:
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
#import "ViewController.h" | |
#import <fishhook.h> | |
@interface ViewController () <NSURLSessionDataDelegate> | |
@end | |
@implementation ViewController | |
int (*origianl_connect)(int, const struct sockaddr *, socklen_t); |
require 'csv' | |
require 'uri' | |
require 'pry' | |
csv_text = File.read('1.csv') | |
csv = CSV.parse(csv_text, :headers => true) | |
hashes = [] | |
csv.each do |row| | |
hash = row.to_hash | |
old = hash["old"] |
// | |
// Token.swift | |
// XProject | |
// | |
// Created by Draveness on 05/04/2017. | |
// Copyright Β© 2017 Draveness. All rights reserved. | |
// | |
import Foundation | |
import RbSwift |
I hereby claim:
To claim this, I am signing this object:
def embeds_many_to_has_many(parent, child) | |
child_key_name = child.to_s.underscore.pluralize | |
parent.collection.find({}).each do |parent_document| | |
next unless parent_document[child_key_name] | |
parent_document[child_key_name].each do |child_document| | |
new_child = child_document.merge( | |
"#{parent.to_s.underscore}_id": parent_document['_id'] | |
) | |
child.collection.insert_one new_child | |
end |
# source: https://robots.thoughtbot.com/debugging-why-your-specs-have-slowed-down | |
# spec/spec_helper.rb | |
config.before(:each, :monitor_database_record_creation) do |example| | |
ActiveSupport::Notifications.subscribe("factory_girl.run_factory") do |name, start, finish, id, payload| | |
$stderr.puts "FactoryGirl: #{payload[:strategy]}(:#{payload[:name]})" | |
end | |
end |
module DatabaseTransformer | |
def self.import(collection, fields, columns) | |
mongo_export = <<-EOF | |
mongoexport --host #{hostname} --username #{username} \ | |
--password #{password} \ | |
--authenticationDatabase #{auth_source} \ | |
--db #{database} --collection #{collection} \ | |
--type=csv \ | |
--fields #{fields.join(',')} \ | |
--out #{collection}.csv |
# frozen_string_literal: true | |
require 'colorize' | |
module DatabaseTransformer | |
attr_reader :database | |
def initialize(database) | |
@database = database | |
end |
# frozen_string_literal: true | |
require 'colorize' | |
module RelationBuilder | |
attr_reader :constants | |
def initialize(constants = []) | |
if constants.present? | |
@constants = constants |