Skip to content

Instantly share code, notes, and snippets.

// "use strict";
const binance = require('node-binance-api');
const chalk = require('chalk');
const log = console.log;
const moment = require('moment');
// percentage of gains targeted
const MIN_PROFIT_TARGET = 0.1;
const MAX_PROFIT_TARGET = 5.0;
const NUMBER_OF_TRADES_OPPORTUNITIES = 1;
let ARBITRAGE_OPP_COUNT = 0;
@cue232s
cue232s / typeahead.css
Created September 20, 2016 03:37 — forked from mapsam/typeahead.css
typeahead styles
.typeahead,
.tt-query,
.tt-hint {
width: 396px;
height: 30px;
padding: 8px 12px;
font-size: 24px;
line-height: 30px;
border: 2px solid #ccc;
-webkit-border-radius: 8px;
@cue232s
cue232s / rails_console_output
Last active August 29, 2015 14:05
Profiler not working, What am I doing wrong??
[22] pry(main)> profile_data = JRuby::Profiler.profile do
[22] pry(main)* [*50..1000].collect {|val| val = val + 10}
[22] pry(main)* end
=> #<Java::OrgJrubyRuntimeProfile::ProfileData:0x63d8669d>
[23] pry(main)> profile_printer = JRuby::Profiler::GraphProfilePrinter.new(profile_data)
=> #<Java::OrgJrubyRuntimeProfile::GraphProfilePrinter:0x18755efe>
[24] pry(main)> profile_printer.printProfile(STDOUT)
Total time: 0.00
namespace :load_data do
desc "loads all of the event data into the database"
task :events => :environment do
# BM Great Lakes Tour = 1
# BM SouthWestern Tour = 2
# BM Wildcards = 3
# BM 100 Tour = 4
# BM Central Tour = 5
# BM Eastern Tour = 6
# BM NorthWestern Tour = 7
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@cue232s
cue232s / promotion_attachment.rb
Created April 2, 2013 17:07
I have two custom validators that check the dimensions of attachments set on my Model using Paperclip. For some reason, the second validator (promotion_image_dimensions) does not run when I manually upload an image that has invalid dimensions. It saves it to the database no problem. Oddly enough, my test show that this validation is being ran, a…
class PromotionAttachment < ActiveRecord::Base
belongs_to :promotion
attr_accessible :like_gate_image, :promotion_image
[:like_gate_image, :promotion_image].each do |file_name|
options = {
styles: {
medium: "300x300>}",
@cue232s
cue232s / gist:5285635
Last active December 15, 2015 15:59
How do I validate the dimensions of attached files given this set up? I have Promotion Model which has a 'has_one' association with the Promotion_Attachment Model. The Promotion_Attachment Model manages a few attached files. I want to be able to validate the dimensions of each uploaded image file upon creation. I'm having trouble figuring out th…
class PromotionAttachment < ActiveRecord::Base
belongs_to :promotion
attr_accessible \
:like_gate_image,
:promotion_image,
:app_icon,
:video_url
@cue232s
cue232s / gist:5153032
Last active December 14, 2015 21:40
I'd like to make my input method have output like this.. how do i get formtastic to do this?
<div class="control-group">
<label class="control-label" for="focusedInput">Focused input</label>
<div class="controls">
<input class="input-xlarge focused" id="focusedInput" type="text" value="This is focused…">
</div>
</div>
routes.rb
namespace :facebook do
namespace :canvas do
namespace :photo_contest do
resources :promotions do
member do
get 'like_gate', :as => "page_like_gate"
get 'info_page'
get 'thank_you_page'
@cue232s
cue232s / updatecampaignlimitsforcustomer.xml
Created October 17, 2012 21:57
I can't update a marketing center's limits via the api.
<soapenv:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:urn='urn:MarketingCenter' xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/'>
<soapenv:Header/>
<soapenv:Body>
<urn:Put soapenv:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>
<Authentication xsi:type='ns1:Authentication'>
<Username xsi:type='xsd:string'>******</Username>
<Password xsi:type='xsd:string'>*******</Password>
<CustomerId xsi:type='xsd:int'>3301</CustomerId>
<Level xsi:type='xsd:int'>1</Level>
<Source xsi:type='xsd:string'>hostname: HOST</Source>