Skip to content

Instantly share code, notes, and snippets.

View jasondelponte's full-sized avatar

Jason Del Ponte jasondelponte

View GitHub Profile
@jasondelponte
jasondelponte / cleverAvgSutdentsPerSecion.go
Last active August 29, 2015 14:01
Simple, (but ugly) script to get the average students per section using Clever.com's API
package main
import (
"encoding/json"
"errors"
"fmt"
"log"
"net/http"
)
@jasondelponte
jasondelponte / contentTypeServe.go
Last active December 27, 2015 23:29
Simple script for testing serving content with different mime times.
package main
import (
"flag"
"fmt"
"log"
"net/http"
"time"
)
@jasondelponte
jasondelponte / ZoomOnItemController
Created April 10, 2013 05:01
very simple unity script to calculate the distance the camera should be placed from an object so that the object's full height will be visible by the camera based on the display's field of view.
using UnityEngine;
using System.Collections;
public class ZoomOnItemContoller : MonoBehaviour {
public float zoomedHeight = 2f;
public float cameraZoomPadding = 0.1f;
public float GetZoomDepth(float fov) {
float halfHight = (zoomedHeight) / 2 + cameraZoomPadding;
@jasondelponte
jasondelponte / br_stage.rb
Created December 12, 2012 21:15
Simple ruby script to rename a git branch to indicate its status. Done, in cr, and on hold are the three statuses currently used, but changing know_stages array to your stages is all that is needed to customize the stages. "b4_stage.rb 404fix incr" => "Renaming 404fix to incr-404fix" "b4_stage.rb 404fix done" => "Renaming incr-404fix to done-404…
#!/usr/bin/env ruby
root_branch = ARGV[0]
stage = ARGV[1]
know_stages = ['done','incr','hold']
cur_branch_name = nil
branches = `git branch`
branches.each_line do |line|
@jasondelponte
jasondelponte / 87easy.go
Created August 11, 2012 23:12
r/dailyprogramer 87 easy
package dp87easy
import (
"math"
)
type Rect struct {
UX, UY int
BX, BY int
}
@jasondelponte
jasondelponte / word_count.go
Created July 1, 2012 07:21
Two Different methods of printing the Nth most common words from a text file. Both examples run in about ~650ms, but if the regex escaping is turned off the time to run is dropped to about 240ms. These times are using Gutenburg's copy of War
package main
import (
"bufio"
"bytes"
"flag"
"fmt"
"os"
"strings"
"errors"
@jasondelponte
jasondelponte / static_serve.go
Created April 24, 2012 21:05
Simple HTTP server which will serve up static content guessing at the correct mime type.
package main
import(
"flag"
"net/http"
"log"
"os"
"fmt"
)
@jasondelponte
jasondelponte / Benchmark tests
Created March 24, 2012 05:13
Simple go web server test doing CPU intensive logic timing
ab -n 1000 -c 5 http://localhost:8080/
Server Software:
Server Hostname: localhost
Server Port: 8080
Document Path: /
Document Length: 20 bytes
@jasondelponte
jasondelponte / main.go
Created March 19, 2011 22:40
Simple Http Server
package main
import (
"http"
"flag"
"fmt"
"os"
"io"
"strconv"
)
@jasondelponte
jasondelponte / synclogger.go
Created December 1, 2010 04:59
Simple synchronized logging utility
// A Simple logger that is synchronized
package synclogger
import (
"io"
"log"
"fmt"
)
type LogType int