Skip to content

Instantly share code, notes, and snippets.

@amgando
amgando / add-near-login.html
Last active July 10, 2022 17:42
integrating NEAR Wallet with a website
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/near-api-js.min.js"></script>
</head>
<body>
<button>Login</button>
<script>

Types

A type is a collection of possible values. An integer can have values 0, 1, 2, 3, etc.; a boolean can have values true and false. We can imagine any type we like: for example, a HighFive type that allows the values "hi" or 5, but nothing else. It's not a string and it's not an integer; it's its own, separate type.

Statically typed languages constrain variables' types: the programming language might know, for example, that x is an Integer. In that case, the programmer isn't allowed to say x = true; that would be an invalid program. The compiler will refuse to compile it, so we can't even run it.

@amgando
amgando / high-performance-learning-references.md
Last active November 16, 2016 20:35
a few high performance learning reference
@amgando
amgando / data-decisions-loops-flow.rb
Last active December 29, 2015 18:42
here's one reasonable approach to introducing someone to programming for the first time
# this file is NOT MEANT TO BE EXECUTED
#-----------------------------------------
# the following notes are related to a short presentation about how to think about programming basics
# the idea is simple: all programming languages basically have 4 common attributes that you can look for when
# you're trying to learn the new language: data, decisions, loops and flow
# the notes here are specific to Ruby but you can basically produce the same thing for any programming language
# echo is like puts for bash (bash is the program running in your terminal)
echo "Loading ~/.bash_profile a shell script that runs in every new terminal you open"
# $VARIABLE will render before the rest of the command is executed
echo "Logged in as $USER at $(hostname)"
# Load RVM into a shell session *as a function*
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
# Path for RVM
test -d $HOME/.rvm/bin && PATH=$PATH:$HOME/.rvm/bin
@amgando
amgando / intro-to-js.js
Last active July 21, 2019 20:19
a quick intro the JS that focuses on functions
// to understand any system we must retain either control or visibility (or both)
// this is how you retain visibility
console.log('hello world')
// so now we can give up our need for control :)
// and along the way you'll see new words and language syntax. share your confusion!
// it's the greatest of gifts from a shameless heart and playfully curious mind.

good presentations

start with a story

  • help people relate
  • opportunity for some fun
  • make it real and relevant

talk about the numbers

  • data on the problem
  • data on the solution
class Window
SCALE = 100
class Collapsed < ArgumentError; end
attr_reader :low, :mid, :high, :max
def set(window)
# p "setting window to #{window}"
@low, @mid, @high = window
class NumberNotFoundError < ArgumentError; end
def render(points, length)
puts "_" * length
display = " " * length
markers = %w[\\ | /]
points.each_with_index do |p, idx|
display[p] = markers[idx]
end
puts "%#{length + 5}s %3s : %3s : %3s" % [display, *points]
# Put your answers here!