Skip to content

Instantly share code, notes, and snippets.

View eprislac's full-sized avatar
🎯
Focusing

Eddie Prislac eprislac

🎯
Focusing
View GitHub Profile
@eprislac
eprislac / datepicker.component.js
Last active September 20, 2017 09:11
Angular 1.5 datetimepicker component
(function() {
angular.module('DatepickerModule', [])
})();
(function() {
'use strict';
/**
* This component is my alternative to the directive wrapper approach, and makes use of
* component's onUpdate method to pass in a callback to the parent component.
@eprislac
eprislac / .gitmessage
Last active January 21, 2019 21:29
.gitmessage
# Subject (one line summary of description)
# __RELATED STORY:__
# __<BUG | FEATURE | CHORE>__ - *<Story Title>*
# \[[#<story-id>](<story-url>)\]
# __DESCRIPTION:__
# Body (What and Why)
# Elaborate on the reasons changes were made here
@eprislac
eprislac / pull_request_template.md
Last active January 24, 2019 00:11
pull_request_template.md

RELATED STORY

<story_type_all_caps(BUG | FEATURE | CHORE)> - <story_title>
[#<story_number>]

DESCRIPTION

Add description here - should describe the problem

STEPS TO REPRODUCE ISSUE

@eprislac
eprislac / array_count_equals_fish.rb
Created February 22, 2019 08:10
An example of the wrong thing to do when reopening a Ruby class
# Never do this for real.
class Array
def count
'fish'
end
end
class Integer
  def fizzbuzziness
  { 'Fizz' => (self % 3).zero?, 'Buzz' => (self % 5).zero? }
  .select { |_key, value| value }
  .keys
  .inject('') { |prev, curr| "#{prev}#{curr}" }
  end
end
(defn fizzbuzziness [num]
  (def tbl {"Fizz" (mod num 3),"Buzz" (mod num 5)})
  (clojure.string/join "" (filter (comp #{0} tbl) (keys tbl))))
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <numeric>
using namespace std;
map<string, bool, greater<string>> fbMap(int num) {
map<string, bool, greater<string>> tbl;
from functools import reduce
def fizzbuzziness(num):
tbl = { 'Fizz': num % 3 == 0, 'Buzz': num % 5 == 0 }
trues = { k: v for k, v in tbl.items() if v }
return reduce((lambda x, y: x + y), list(trues.keys()), '')
(() => {
'use strict'
const fizzbuzziness = (num) => {
const tbl = Object({ 'Fizz': (num % 3 === 0), 'Buzz': (num % 5 === 0) })
return Object
.keys(tbl)
.filter(key => tbl[key])
.reduce((acc, curr) => { return `${acc}${curr}` }, '')
}
// num is a whole number Integer
(const fizzbuzziness = (num) => {
if((num % 3 === 0) && (num % 5 === 0)) {
return 'FizzBuzz'
} else if(num % 3 === 0) {
return 'Fizz'
} else if(num % 5 === 0) {
return 'Buzz'
} else {
return ''