This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$( document ).ready(function() { | |
var replace_text_element_with_provinces = function(text_element) { | |
/* | |
Accepts a reference to a form's text element, builds a select | |
element populated with Canadian provinces and replaces the text | |
element with the select element. | |
*/ | |
var provinces = $("#id_country").data("provinces"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A dictionary comprehension: | |
a = {num: Node(num) for num in range(1, 8)} | |
``` | |
a now looks like: | |
{1: Node(data=1, next_node=None), | |
2: Node(data=2, next_node=None), | |
3: Node(data=3, next_node=None), | |
4: Node(data=4, next_node=None), | |
5: Node(data=5, next_node=None), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import fileinput | |
def data_stream(): | |
for line in fileinput.input(): | |
line = line.strip() | |
yield line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
https://www.hackerrank.com/challenges/luck-balance | |
[(6, 3), (5, 1), (2, 1), (1, 1), (8, 1), (10, 0), (5, 0),] | |
""" | |
import fileinput | |
def data_stream(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fileinput | |
import sys | |
sys.setrecursionlimit(10000) | |
def solve(houses, transmitter_range): | |
houses.sort(reverse=True) | |
if len(houses) == 0: | |
return 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Path /Users/liavkoren/.config/powerline/colorschemes/solarized.json.old is not a directory or configuration file | |
Path /Users/liavkoren/.config/powerline/colorschemes/vim/solarized.json.old is not a configuration file | |
Path /Users/liavkoren/.config/powerline/colorschemes/vim/solarizedlight.json.old is not a configuration file | |
One of the either variants failed. Messages from the first variant: | |
Error while loading groups (key /groups/email_alert) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ImportError Traceback (most recent call last) | |
<ipython-input-1-e19bbed7988a> in <module>() | |
----> 1 import ipytracer | |
2 from IPython.core.display import display | |
3 | |
4 def bubble_sort(unsorted_list): | |
5 x = ipytracer.ChartTracer(unsorted_list) | |
/Users/liavkoren/Envs/coding-university/lib/python3.6/site-packages/ipytracer/__init__.py in <module>() | |
14 """ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from enum import Enum | |
import attr | |
from attr.validators import instance_of | |
@attr.s | |
class EdgeNode: | |
""" | |
An Edge & a Node. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import defaultdict | |
initial_pages = defaultdict(lambda: 0) | |
bounce_rates = defaultdict(lambda: 0) | |
for line in open('site_data.csv'): | |
first, second = line.rstrip().split(',') | |
if first == '-1': | |
initial_pages[second] += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lookup = { | |
'1': 'one', | |
'2': 'two', | |
'3': 'three', | |
'4': 'four', | |
'5': 'five', | |
'6': 'six', | |
'7': 'seven', | |
'8': 'eight', | |
'9': 'nine', |
OlderNewer