Skip to content

Instantly share code, notes, and snippets.

View pori's full-sized avatar
💃
Fabulous!

Alice Hernandez pori

💃
Fabulous!
View GitHub Profile
@pori
pori / geo-example.js
Last active August 29, 2015 14:01
A simple script demonstrating MongoDB's geospatial index support
/**
* Example used for "Geographic Data with MongoDB" article at Orlando Data Science.
* Url: http://orlandods.com/geo-locational-data-mongodb/
* Author: Pori
*/
var db = new Mongo().getDB('geodb');
db.places.drop(); // Remove leftover points from previous examples.
@pori
pori / examples.py
Last active August 29, 2015 14:04
Python examples for a tech summer camp
def first_function():
print "Hello all!"
fisrt_function()
def what_is_my_name(name):
print "My name is " + name
#what_is_my_name("Alex")
@pori
pori / UDPServer.java
Created August 10, 2014 01:52
A simple UDP packet sending command line application.
import java.io.*;
import java.net.*;
import java.util.Scanner;
class UDPServer
{
public static void main(String args[]) throws Exception
{
Scanner in = new Scanner(System.in);
@pori
pori / HashtableExample.java
Last active August 29, 2015 14:05
An example of hashtables in Java
import java.util.Hashtable;
import java.util.Set;
public class HashtableExample {
public static void main(String[] args) {
Hashtable<String, Integer> ages = new Hashtable<String, Integer>();
ages.put("Pori", 21);
ages.put("Octocat", 6);
@pori
pori / Quicksort.java
Last active August 29, 2015 14:05
Just an implementation of Quicksort done in Java.
import java.util.Arrays;
public class Quicksort {
public static void main(String[] args) {
int[] set = { 3, 6, 1, 5, 12, 10 };
System.out.println("Before: " + Arrays.toString(set));
Quicksort.sort(set);
System.out.println("After: " + Arrays.toString(set));
@pori
pori / Mergesort.java
Last active August 29, 2015 14:05
A Mergesort algorithm for quick usage.
import java.util.Arrays;
public class Mergesort {
public static void main(String[] args) {
int[] set = { 3, 6, 1, 5, 12, 10 };
System.out.println("Before: " + Arrays.toString(set));
Mergesort.sort(set);
System.out.println("After: " + Arrays.toString(set));
}
@pori
pori / DepthFirstSearch.java
Created August 25, 2014 15:46
A really, really simple depth first search implementation.
import java.util.Arrays;
public class DepthFirstSearch {
public static void main(String[] args) {
int[][] graph = {
{ 0, 1, 2 },
{ 0, 1, 2 },
{ 0, 1, 2 },
};
boolean[] found = new boolean[ graph[0].length ];
@pori
pori / BreadthFirstSearch.java
Last active August 29, 2015 14:05
An overly simple breadth first search implementation.
import java.util.Queue;
import java.util.List;
import java.util.LinkedList;
import java.util.ArrayList;
public class BreadthFirstSearch {
public static void main(String args[]) {
int[][] graph = {
{ 0, 1, 2 },
{ 0, 1, 2 },
@pori
pori / array_value_swap.c
Created September 5, 2014 13:58
An array value swap example.
#include <stdio.h>
void swap(int * set, int i, int j);
int main() {
int set[] = { 1, 2 };
swap(set, 0, 1);
printf("{ %d, %d }\n", set[0], set[1]);
@pori
pori / package.json
Created January 23, 2015 01:17
A package configuration that's nice for developing RESTful api's in Node.js
{
"name": "some-api",
"version": "1.0.0",
"description": "Some api description.",
"dependencies": {
"express": "~4.10",
"body-parser": "1.x",
"multer": "~0.1.7",
"passport": "0.2.1",
"passport-http": "0.2.2",