This file contains hidden or 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
tarting_value = [0, 0] + [3 for i in range(5)] + [4, 3, 4] | |
partial_sums = [sum(starting_value[:i]) for i in range(len(starting_value)+1)] | |
letter_to_number = dict(reduce( | |
lambda x, | |
y: x+y, | |
[map(lambda letter: (letter, number), letters) for number, letters in enumerate(map(lambda a_list: map(lambda char: chr(char+65), a_list), [range(*value) for value in zip(partial_sums[:-1], partial_sums[1:])]))] | |
)) | |
This file contains hidden or 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or 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 okcupyd import User | |
def stuff(): | |
user = User() | |
profiles = user.search() | |
for profile in profiles[:1]: | |
for q in profile.questions[:10]: | |
# encoding data to utf8 |
This file contains hidden or 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
(defun get-ensime-type-info-from-mark () | |
(interactive) | |
(message "%s" (ensime-rpc-inspect-type-at-range (get-eol-range)))) | |
(defun get-eol-range () | |
(interactive) | |
`(,(marker-position (point-marker)) | |
,(save-excursion (end-of-line) (point)))) |
This file contains hidden or 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 requests | |
import subprocess | |
from lxml import html | |
from xpath import xpb | |
def get_stdout_from_command(command, args): | |
return subprocess.Popen(command, stdout=subprocess.PIPE).stdout.read() | |
This file contains hidden or 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
[user] | |
name = Ivan Malison | |
email = [email protected] |
This file contains hidden or 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
def rotate_array(incoming, rotation_index): | |
new_back = incoming[:rotation_index] | |
new_front = incoming[rotation_index:] | |
new_front.extend(new_back) | |
return new_front | |
def binary_search( | |
array, item, low=0, high=None, | |
lower_predicate=lambda item, array, index, low, high: item <= array[index] |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Manifold</title> | |
</head> | |
<body> | |
<%= render "layouts/errors" %> | |
<% if logged_in? %> | |
<%= current_user.email %> | |
<%= button_to "Sign Out", session_url, method: :delete %> |
This file contains hidden or 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
(defun github-clone-get-repo-name-from-remote (&optional remote) | |
(unless remote | |
(setq remote | |
(magit-read-remote "Select a remote: "))) | |
(github-clone-repo-name | |
(magit-get "remote" remote "url"))) | |
(defun github-clone-fork-remote (&optional remote) | |
(interactive (list (magit-read-remote "Select a remote"))) | |
(cl-destructuring-bind (user . repo) |
OlderNewer