Skip to content

Instantly share code, notes, and snippets.

Leah Hanson astrieanna

Block or report user

Report or block astrieanna

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View index.html
<script src="https://facebook.github.io/react/js/jsfiddle-integration-babel.js"></script>
<div id="container">
<!-- This element's contents will be replaced with your component. -->
</div>
@astrieanna
astrieanna / draft.asciidoc
Created Apr 6, 2015
NetCDF section for Learning Julia (with full script); not planning to include in book
View draft.asciidoc

Writing a Parser

Our goal for this section is to parse a NetCDF file. NetCDF is a binary format, which is most often used for climatology/geoscience data. Because it is a custom binary format, we’re going to write a custom parser for it by hand.

Tip

If you have a format based on JSON or XML to parse, then you should start with JSON.jl or julia-xml-library, rather than writing it by hand.

@astrieanna
astrieanna / CodeTypeSample.ipynb
Created Mar 13, 2015
Using the output of code_typed
View CodeTypeSample.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@astrieanna
astrieanna / mlemming.elm
Last active Aug 29, 2015
Mario has visible platforms (multiple!) that he runs into, sorta. He also walks like a lemming.
View mlemming.elm
import Keyboard
import Window
-- MODEL
type Lemming = {x:Int, y:Int, vx:Float, vy:Float, dir:String, onSurface:Bool}
mario1:Lemming
mario1 = { x=20, y=900, vx=0, vy=0, dir="right", onSurface=False }
mario2:Lemming
mario2 = { x=60, y=900, vx=0, vy=0, dir="right", onSurface=False }
allMarios = [mario1, mario2]
@astrieanna
astrieanna / cube.elm
Created Sep 21, 2014
modified version of http://elm-lang.org/edit/examples/WebGL/Cube.elm left-right movement of mouse controls cube rotation
View cube.elm
import Math.Vector3 (..)
import Math.Matrix4 (..)
import Graphics.WebGL (..)
import Mouse
-- Create a cube in which each vertex has a position and color
type Vertex = { color:Vec3, position:Vec3 }
@astrieanna
astrieanna / squares.elm
Created Sep 21, 2014
modified version of http://elm-lang.org/edit/examples/Elements/Lines.elm (the red square follows the mouse)
View squares.elm
import Mouse
# Separating main and squares was key to making lift work
# I don't know how to convert Signal (Int,Int) to Signal (Float,Float)
# so I separated x and y into different arguments
main = lift2 squares (toFloat <~ Mouse.x)
(toFloat <~ Mouse.y)
squares : Float -> Float -> Element
squares x y =
@astrieanna
astrieanna / test.jl
Created Dec 7, 2013
Trying to make `methodswith` work for a user-defined type.
View test.jl
module Test
export TwoVals, addtwovals
type TwoVals
val1
val2
end
function addtwovals(v::TwoVals)
v.val1 + v.val2
@astrieanna
astrieanna / chart.jl
Last active Dec 22, 2015
Making Vega.jl plot
View chart.jl
#Pkg.add for JSON
#Pkg.clone for Vega.jl, JSTypes
xs = open("xs.txt","r")
ys = open("ys.txt","r")
xarr = readdlm(xs)
yarr = readdlm(ys)
x2 = Float64[x for x in xarr]
y2 = Float64[y for y in yarr]
View Foo.jl
module Foo
export @timeof, @bench, BinaryTree, Node, Leaf, insert
macro timeof(expr)
quote
t1 = time()
value = $(expr)
t2 = time()
t2-t1
View configure.log
configure: looking for configure programs
configure: found cmp
configure: found mkdir
configure: found printf
configure: found cut
configure: found grep
configure: found xargs
configure: found cp
configure: found find
configure: found uname
You can’t perform that action at this time.