Skip to content

Instantly share code, notes, and snippets.

View aberke's full-sized avatar

Alex aberke

View GitHub Profile
@aberke
aberke / cracklepop.go
Last active April 12, 2019 21:14
Crackle Pop implemented in Go.
package main
import "fmt"
func main() {
for i := 1; i <= 100; i++ {
if i%3 == 0 && i%5 == 0 {
fmt.Println("CracklePop")
} else if i%3 == 0 {
fmt.Println("Crackle")
@aberke
aberke / xaero_and_palindromic_strings.py
Created March 1, 2017 15:42
Solution to Hacker Rank Challenge: Xaero And Palindromic Strings -- Finds probability of palindromic substrings when a given string
"""
Alex Berke (aberke)
Problem:
--------
https://www.hackerrank.com/contests/101hack29/challenges/xaero-and-palindromic-strings/copy-from/1300744544
A string is called a palindromic string if it can be read the same going forward as well as backwards.
What is the probability of choosing a substring of such that the letters of the chosen substring can be
shuffled to make it a palindromic string?
@aberke
aberke / tictactoe.py
Created January 16, 2017 14:24
Simple implementation of a simple classic: Tic Tac Toe
# -*- coding: utf-8 -*-
"""
Tic-Tac-Toe
-----------
Play from command line:
$ python main.py
"""
QUIT = "q"
@aberke
aberke / snapcracklepop.py
Created January 5, 2017 20:30
Snap Crackle Pop: Prints out the numbers 1 to 100 (inclusive). If the number is divisible by 3, print Crackle instead of the number. If it's divisible by 5, print Pop. If it's divisible by both 3 and 5, print CracklePop.
"""
Snap Crackle Pop
----------------
Prints out the numbers 1 to 100 (inclusive).
If the number is divisible by 3, print Crackle instead of the number.
If it's divisible by 5, print Pop. If it's divisible by both 3 and 5, print CracklePop!
"""
MIN = 1
@aberke
aberke / snapcracklepop.erl
Last active January 5, 2017 20:27
Snap Crackle Pop: Prints out the numbers 1 to 100 (inclusive). If the number is divisible by 3, print Crackle instead of the number. If it's divisible by 5, print Pop. If it's divisible by both 3 and 5, print CracklePop.
%%%-------------------------------------------------------------------
%%% @doc
%%% Snap Crackle Pop
%%% Prints out the numbers 1 to 100 (inclusive).
%%% If the number is divisible by 3, print Crackle instead of the number.
%%% If it's divisible by 5, print Pop.
%%% If it's divisible by both 3 and 5, print CracklePop.
%%%
%%% Run (the simple way):
%%% - Download erlang/otp: $ brew install erlang
@aberke
aberke / gist:042eef0f37dba1138f9e
Last active June 20, 2020 05:17
AngularJS module for phonenumber inputs - Includes custom directive that formats telephone number input values as well as filter for format them in text.
/***************************************************
----------------------------------------------------
Author: Alexandra Berke (aberke)
Written: Summer 2014
----------------------------------------------------
Formats the phonenumber as (222) 333-4444 within the input element
Binds only the number 2223334444 to the model