Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

To claim this, I am signing this object:

# flake8: noqa
import os
import sys
# This function sorts a list of numbers but
# prioritizes one group of numbers to come first.
# It returns whether the higher-priority items were seen at all.
def sort_priority(numbers, group):
found = False
def extend_list(val, list=[]):
list.append(val)
return list
list1 = extend_list(10)
list2 = extend_list(123, [])
list3 = extend_list('a')
print("list1 = %s" % list1)
def index_words(text):
result = []
if text:
result.append(0)
for index, letter in enumerate(text):
if letter == ' ':
result.append(index + 1)
return result
import os
import sys
def find_min():
# implement your logic here
pass
def print_usage():
import os
import sys
from threading import Thread
class Counter(object):
def __init__(self):
self.count = 0
def increment(self, offset):
const jsdom = require("jsdom");
const { JSDOM } = jsdom;
const dom = new JSDOM(`<body></body>`, { runScripts: "dangerously" });
function createDom(total) {
for (var i = 0; i < total; i++) {
var btn = dom.window.document.createElement('button');
btn.appendChild(dom.window.document.createTextNode('Button ' + i));
btn.addEventListener('click', function(){ console.log(i); });
var args = process.argv.slice(2);
var hero = {
name: args[0],
getSecretIdentity: function (){
return this.name;
}
};
var stoleSecretIdentity = hero.getSecretIdentity;
var list = process.argv.slice(2);
var sum = 0;
var add = function() {
if (list.length === 0) {
console.log('sum ' + sum);
}
var item = list.pop();
function foo()
{
return
{
bar: "hello"
};
}
console.log(foo())