Skip to content

Instantly share code, notes, and snippets.

# Constants for the initial state of the liquidity pool
x_initial = 1000 # Initial amount of Token A
y_initial = 1000 # Initial amount of Token B
k = x_initial * y_initial # Constant product k
delta_x = 100 # Amount of Token A being swapped
# New amount of Token A in the pool
x_final = x_initial + delta_x
# Calculate the new amount of Token B using the constant product formula
<p>
email:
<script type="text/javascript">
// <![CDATA[
document.write(
"<n uers="znvygb:anzr@qbznva.pbz">".replace(/[a-zA-Z]/g, function(c){return String.fromCharCode((c<="Z"?90:122)>=(c=c.charCodeAt(0)+13)?c:c-26);}));
// ]]>
</script>
<span style="unicode-bidi:bidi-override; direction: rtl">moc.niamod@eman</span>
</a>
heroku plugins:install https://github.com/heroku/heroku-labs.git
heroku labs:enable user_env_compile -a myapp
@JohnPlummer
JohnPlummer / error
Created February 14, 2012 22:07
Heroku and gemfile conditions
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.
You have deleted from the Gemfile:
* rb-fsevent
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/rails app
@JohnPlummer
JohnPlummer / call_partial_1.rb
Created January 31, 2012 12:52
Optional Parameters in View Partials
render 'shared/events_table', events: @events, title: 'Your Events'
@JohnPlummer
JohnPlummer / .Gemfile
Created December 13, 2011 15:19
Rails 3.1 on Heroku, TLDR Version
source 'http://rubygems.org'
gem 'rails', '3.1.1'
gem 'thin'
gem 'pg'
# Gems used only for assets and not required
# in production environments by default.
<span style="unicode-bidi:bidi-override; direction: rtl">moc.niamod@eman</span>
@JohnPlummer
JohnPlummer / application1.rb
Created June 9, 2011 19:48
jquery-rails setting default scripts
# config.action_view.javascript_expansions[:defaults] = %w()
@JohnPlummer
JohnPlummer / .gvimrc
Created May 16, 2011 10:15
NerdTree Janus Fix
autocmd WinEnter * call s:CloseIfOnlyNerdTreeLeft()
" Close all open buffers on entering a window if the only
" buffer that's left is the NERDTree buffer
function s:CloseIfOnlyNerdTreeLeft()
if exists("t:NERDTreeBufName")
if bufwinnr(t:NERDTreeBufName) != -1
if winnr("$") == 1
q
endif