Skip to content

Instantly share code, notes, and snippets.

View mikeyakymenko's full-sized avatar
🏠
Working from home

Mike Yakymenko mikeyakymenko

🏠
Working from home
View GitHub Profile
@mikeyakymenko
mikeyakymenko / gist:27547cd2e8dfc1430d173dd50df46bc5
Created April 7, 2016 21:03 — forked from Atem18/gist:4696071
Tutorial to seting up a django website in production.

Set up Django, Nginx and Gunicorn in a Virtualenv controled by Supervisor

Steps with explanations to set up a server using:

  • Virtualenv
  • Virtualenvwrapper
  • Django
  • Gunicorn
@mikeyakymenko
mikeyakymenko / forms.py
Created June 13, 2016 11:46 — forked from amatellanes/forms.py
A Yes/No field for Django.
from django import forms
class Form(forms.Form):
field = forms.TypedChoiceField(coerce=lambda x: x =='True',
choices=((False, 'No'), (True, 'Yes')))
@mikeyakymenko
mikeyakymenko / README.md
Created September 14, 2016 12:55 — forked from joyrexus/README.md
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@mikeyakymenko
mikeyakymenko / A.markdown
Created September 20, 2016 10:28 — forked from larrybotha/A.markdown
Custom social sharing icons
@mikeyakymenko
mikeyakymenko / postgres-brew.md
Created June 7, 2017 07:32
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@mikeyakymenko
mikeyakymenko / someMatrix.js
Created March 29, 2018 18:03
some matrix generators (for Oleg)
const genMatrix = (args) => {
return Array.isArray(args) ? args.map((item) => genMatrix(item))
: Array.apply(null, {length: args}).map(() => false)
}
const genMatrix2 = (args) => {
if (Array.isArray(args)) {
return args.map((item) => genMatrix2(item))
}
else {
@mikeyakymenko
mikeyakymenko / roundRobin.py
Created May 29, 2018 21:30 — forked from Makistos/roundRobin.py
A round-robin algorithm implementation written in Python. #round-robin #scheduling #algorithm #python
#!/usr/bin/python
div1 = ["Lions", "Tigers", "Jaguars", "Cougars"]
div2 = ["Whales", "Sharks", "Piranhas", "Alligators"]
div3 = ["Cubs", "Kittens", "Puppies", "Calfs"]
def create_schedule(list):
""" Create a schedule for the teams in the list and return it"""
s = []
@mikeyakymenko
mikeyakymenko / round-robin.py
Created May 29, 2018 21:30 — forked from ih84ds/round-robin.py
Generate Round Robin Schedule with Balanced Home/Away in Python
def create_balanced_round_robin(players):
""" Create a schedule for the players in the list and return it"""
s = []
if len(players) % 2 == 1: players = players + [None]
# manipulate map (array of indexes for list) instead of list itself
# this takes advantage of even/odd indexes to determine home vs. away
n = len(players)
map = list(range(n))
mid = n // 2
for i in range(n-1):
@mikeyakymenko
mikeyakymenko / robin.js
Created June 24, 2018 12:40
Round robin, league matches schedule on javascript
let teams = [
'Tigers',
'Foofels',
'Drampamdom',
'Lakebaka'
]
const roundRobin = (teams) => {
let schedule = []
let league = teams.slice()
@mikeyakymenko
mikeyakymenko / candies.js
Created September 22, 2019 15:08
Some candies ;)
var candies1 = [3, 4, 7, 7, 6, 6]
var candies2 = [5, 1, 12, 12, 12, 5, 6, 8, 8, 5]
var candies3 = [80, 80, 1000000000, 80, 80, 80, 80, 80, 80, 123456789]
var candies = [5, 1, 12, 12, 12, 5, 6, 8, 8, 5]
var typesOfCandies = function(arr) {
var finalResult = {};
var counting = arr.reduce(function(result, current) {