Skip to content

Instantly share code, notes, and snippets.

View amscotti's full-sized avatar
😀

Anthony Scotti amscotti

😀
View GitHub Profile

Keybase proof

I hereby claim:

  • I am amscotti on github.
  • I am amscotti (https://keybase.io/amscotti) on keybase.
  • I have a public key whose fingerprint is 3A0C E703 9982 AA6C 9048 6ED3 D2A9 0719 3B06 B986

To claim this, I am signing this object:

hello = fn(text) ->
fn(name) ->
"#{text} #{name}"
end
end.("Hello")
IO.inspect hello.("World") # "Hello World"
IO.inspect Enum.reduce(Enum.filter(1..999,fn(x) -> rem(x, 3) == 0 || rem(x, 5) == 0 end), 0, &1+&2)
@amscotti
amscotti / factorial.exs
Created September 29, 2013 02:03
Example of pattern matching in Elixir
defmodule Factorial do
def of(0), do: 1
def of(n), do: n * of(n-1)
end
IO.inspect Factorial.of(4)
@amscotti
amscotti / functions.coffee
Last active December 20, 2015 05:09
Syntax comparison of Functions using CoffeeScript, Dart, and TypeScript.
divisible = 3
divisibleReporter = (lastFound, nextDivisible) ->
"Found: #{lastFound}, Next: #{nextDivisible}"
divisibleKeeper = ((divisible) ->
lastFound = 0
nextDivisible = divisible
(number) ->
if (number >= nextDivisible)
@amscotti
amscotti / DocWho.coffee
Last active December 19, 2015 13:19
Syntax comparison of Classes and Inheritance using CoffeeScript, Dart, and TypeScript.
class Character
@name
constructor: (person, @role) ->
@name = "#{person.firstname} #{person.lastname}"
toString: () ->
"#{@role} played by #{@name}"
@Grab(group='org.ccil.cowan.tagsoup', module='tagsoup', version='1.2' )
def tagsoupParser = new org.ccil.cowan.tagsoup.Parser()
def slurper = new XmlSlurper(tagsoupParser)
def url = "http://www.nfl.com/stats/categorystats?archive=false&conference=null&statisticCategory=PASSING&season=2010&seasonType=REG&experience=null&tabSeq=0&qualified=true&Submit=Go"
def htmlParser = slurper.parse(url)
tabledata = htmlParser.'**'.find { it.@class == 'data-table1' }.tbody.tr.collect {
[
Rk: it.td[0].text().trim(),
Player: it.td[1].text().trim(),
#!/usr/local/bin/python
#Used to make snapshot of all the file systems on a zpool.
import commands
import subprocess
import time
import os
timestamp = time.strftime("%Y%m%d-%H%M")
import java.awt.Dimension
import java.awt.Graphics2D
import java.awt.RenderingHints
import java.awt.image.BufferedImage
import javax.imageio.ImageIO
import org.w3c.dom.Document
import org.w3c.tidy.Tidy
import org.xhtmlrenderer.simple.Graphics2DRenderer
def makeThumbnail(address) {
require 'net/http'
require 'net/https'
require 'base64'
http = Net::HTTP.new('go.netatlantic.com', 82)
http.use_ssl = false
path = '/'
# SOAP Envelope
data = <<-EOF