Skip to content

Instantly share code, notes, and snippets.

View kgashok's full-sized avatar
🎯
Focusing

Ashok Bakthavathsalam kgashok

🎯
Focusing
View GitHub Profile

list of programming project ideas

Board games

Any two player board game is a good exercise for basic programming logic, and you can make it into a console application. Checkers, Connect-4, Othello, Poker, Go, whatever. Chess is somewhat harder than those other games.

Here are some ways to extend these projects:

  • Add the ability to save and load games
  • Add an AI
@kgashok
kgashok / Sample.elm
Last active April 30, 2016 23:47
Modification of Rundberget's version at (https://gist.github.com/rundis/8b5a0fd09c3eb348dfc2aa7e862436b4) to use String as a stack
import SStack as Stack exposing (..)
import Html exposing (..)
reverseString : String -> String
reverseString str =
Stack.reverse str
main : Html.Html
main =
@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
@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!"
@yang-wei
yang-wei / decode.md
Last active April 2, 2024 20:18
Elm Json.Decode tutorial and cheatsheet

When receiving JSON data from other resources(server API etc), we need Json.Decode to convert the JSON values into Elm values. This gist let you quickly learn how to do that.

I like to follow working example code so this is how the boilerplate will look like:

import Graphics.Element exposing (Element, show)
import Task exposing (Task, andThen)
import Json.Decode exposing (Decoder, int, string, object3, (:=))

import Http
@fasiha
fasiha / example.json
Last active April 14, 2020 23:49
Super-simple Elm app to read JSON from a REST API, convert it to a nested Elm data structure, and print the result in the browser.
[
{
"japanese": "ボブは魚が好きだ。",
"english": "Bob likes fish.",
"tags": [],
"ve": [
{
"word": "ボブ",
"lemma": "ボブ",
"part_of_speech": "proper noun",
@junjiah
junjiah / bellman_ford.py
Created August 30, 2015 14:03
solved 'Breadth First Search: Shortest Reach' on hackerrank https://www.hackerrank.com/challenges/bfsshortreach
from collections import namedtuple
# A reasonable large number to represent infinity.
INF = (1 << 31)
UNIT_LENGTH = 6
# Struct for edges.
Edge = namedtuple('Edge', ['src', 'dest'])
def calculate_shortest_distances(node_num, edges, src):
@ohanhi
ohanhi / frp.md
Last active December 23, 2022 13:06
Learning FP the hard way: Experiences on the Elm language

Learning FP the hard way: Experiences on the Elm language

by Ossi Hanhinen, @ohanhi

with the support of Futurice 💚.

Licensed under CC BY 4.0.

Editorial note

@refo
refo / remove-leading-slash
Created June 5, 2015 13:27
javascript - Remove leading slashes
'/example/string/'.replace(/^\/+/g, '');
// Should remove all leading slashes and return 'example/string/'
@non
non / answer.md
Last active January 9, 2024 22:06
answer @nuttycom

What is the appeal of dynamically-typed languages?

Kris Nuttycombe asks:

I genuinely wish I understood the appeal of unityped languages better. Can someone who really knows both well-typed and unityped explain?

I think the terms well-typed and unityped are a bit of question-begging here (you might as well say good-typed versus bad-typed), so instead I will say statically-typed and dynamically-typed.

I'm going to approach this article using Scala to stand-in for static typing and Python for dynamic typing. I feel like I am credibly proficient both languages: I don't currently write a lot of Python, but I still have affection for the language, and have probably written hundreds of thousands of lines of Python code over the years.