Skip to content

Instantly share code, notes, and snippets.

View kgashok's full-sized avatar
🎯
Focusing

Ashok Bakthavathsalam kgashok

🎯
Focusing
View GitHub Profile
#include <iostream>
#include <map>
#include <stack>
bool IsBalanced(const char delimStr[]) {
using std::make_pair;
std::map< char, char > delims;
const char* curChar = delimStr;
std::stack< char > store;
import scala.io.Source;
import scala.collection.mutable;
class Anagrams(file:String){
private val combinations = mutable.Map.empty[String, List[String]];
def run() : List[List[String]] = {
for( word <- Source.fromFile(file).getLines ){
val characterStr = sortByChars(word.trim);
@danprager
danprager / roman.py
Created February 5, 2012 18:52
Simple roman numeral library
old_roman = (('M', 1000),
('D', 500),
('C', 100),
('L', 50),
('X', 10),
('V', 5),
('I', 1))
new_roman = (('M', 1000),
('CM', 900),
@int3
int3 / hashtable.c
Created December 10, 2012 17:34
Simple open-addressed hashtable
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <assert.h>
// no actual pointer should have this value, due to alignment
static void* DELETED = (void*)1;
static int TABLE_SIZE = 701;
@zitmen
zitmen / heap.cpp
Last active December 16, 2015 00:19
Binary Heap - very simple, but works correctly and fast
#ifndef __BINARY_HEAP_H__
#define __BINARY_HEAP_H__
#include <exception>
#include <ostream>
using std::exception;
using std::ostream;
template<typename T>
class BinaryHeap
@ChewingPencils
ChewingPencils / drafts2trello.py
Created May 6, 2013 14:39
Drafts to Trello - Used for a Drafts app action. #python #pythonista #url_scheme
#!/usr/bin/env python
#
# drafts2trello.py
# Sean Korzdorfer
# Mon 2013-05-04
import argparse
import requests
import sys
import json
@imduffy15
imduffy15 / CA212.md
Last active December 17, 2015 14:49

2012

Question 1

Part A

#include <iostream>

using namespace std;
/*
* Sugar for type detection working across frames and browsers ;)
*
* Detected types
*
* 'arguments', 'array', 'boolean', 'date', 'document', 'element', 'error', 'fragment',
* 'function', 'nodelist', 'null', 'number', 'object', 'regexp', 'string', 'textnode',
* 'undefined', 'window'
*
* Copyright (c) 2009 Daniel Steigerwald (http://daniel.steigerwald.cz), Mit Style License
@kgashok
kgashok / first.elm
Last active April 29, 2016 20:32
First Elm program from Sublime
-- https://packagecontrol.io/packages/sublime-github
import Html exposing (..)
main =
text "Hello, World!"
@kgashok
kgashok / Sample.elm
Created April 30, 2016 17:30 — forked from rundis/Sample.elm
Reversing a string using a stack
module Sample where
import Stack exposing (..)
import String
import Html exposing (..)
reverseString : String -> String
reverseString str =
String.split "" str
|> Stack.fromList