Skip to content

Instantly share code, notes, and snippets.

import React from 'react';
import ReactDOM from 'react-dom';
export default class Portal extends React.Component {
root = null;
constructor(props) {
super(props);
this.el = document.createElement('div');
}
require 'authorizenet'
class PaymentAuthorization
attr_reader :response
def initialize(response)
@response = response
end
def successful?
run.config:
extra_steps:
- "run locally"
- "run after app's runtime is built"
- "but before runtime is packaged for use"
- "Environment variables are not available during the build process."
- "No access to data services"
- "Code is fully writable"
@brandoncc
brandoncc / config.yml
Last active October 26, 2018 17:47
nanobox circleci config
version: 2
jobs:
test-job:
machine: true
steps:
- checkout
- run: sudo bash -c "$(curl -fsSL https://s3.amazonaws.com/tools.nanobox.io/bootstrap/ci.sh)"
- run: nanobox evar add local CLOUDINARY_API_KEY=$CLOUDINARY_API_KEY
require 'pry'
# Constants
INITIAL_MARKER = " "
PLAYER_MARKER = "X"
COMPUTER_MARKER = "O"
WINNING_LINES = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] + # rows
[[1, 4, 7], [2, 5, 8], [3, 6, 9]] + # columns
[[1, 5, 9], [3, 5, 7]] # diagonals
namespace :figaro do
desc "SCP transfer figaro configuration to the shared folder"
task :setup do
on roles(:app) do
upload! "config/application.yml", "#{shared_path}/config/application.yml", via: :scp
end
end
desc "Symlink application.yml to the release path"
task :symlink do
# I wrote this script because I had a bunch of heroku apps on my account that I didn't know what
# local apps they matched. Just search the heroku app name and this script will find the local
# app for you.
#
# Feel free to use and alter this script as much as you want.
unless ARGV[0]
fail 'You pust provide repo name to search for'
end
require "net/http"
require "nokogiri"
unless [1, 2].include? ARGV.length
puts "Usage: TERM [max number of results to display]"
exit
end
def max_results
max = ARGV[1].to_i
// choose a random number which is inclusively between min and max
chooseRandomBetween = function(min, max) {
var difference = Math.abs(max - min) + 1;
return Math.floor(Math.random() * difference) + Math.min(min, max);
}
def balance_to_dollars(balance)
balance = "#{'%.2f' % balance}"
dollars = balance.split('.')[0]
cents = balance.split('.')[1]
dollars = dollars.reverse.gsub(/...(?=.)/,'\&,').reverse
"$#{dollars}.#{cents}"
end
print "What is your current age? "