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
(function() { | |
var outDiv = document.createElement("div"); | |
document.body.appendChild(outDiv); | |
var history_item = document.getElementById("history-app").shadowRoot.getElementById("history").shadowRoot.getElementById("infinite-list").getElementsByTagName("history-item"); | |
var output = new Set(); | |
document.body.onkeydown = function handle(e) { | |
if (e.keyCode == 34) { | |
for (item in history_item) { | |
var item = history_item[item].shadowRoot; | |
if (!item) continue; |
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
package main | |
import ( | |
"fmt" | |
"sort" | |
) | |
func OrderedInsert(a []int, j int) []int { | |
n := len(a) | |
if n == 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
import sys | |
class ProgressBar(object): | |
def __init__(self, total, prefix='', suffix='', decimals=1, bar_length=100): | |
""" | |
Call in a loop to create terminal progress bar | |
:param total: total iterations | |
:param prefix: prefix string | |
:param suffix: suffix string |
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 SocketServer | |
import SimpleHTTPServer | |
import urllib | |
import re | |
from BeautifulSoup import BeautifulSoup, NavigableString, Tag, PageElement | |
TARGET = 'habrahabr.ru' | |
HOST = '127.0.0.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
class Item(object): | |
def __init__(self, data): | |
self.prev = None | |
self.next = None | |
self.data = data | |
def delete(self): | |
if self.prev != None: | |
self.prev.next = self.next |
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
// ==UserScript== | |
// @name vk ads blocker | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Hide advertising on vk.com! | |
// @author Ilya Chistyakov | |
// @match *://vk.com/* | |
// @grant none | |
// ==/UserScript== |
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
def log(f): | |
def wrap(*args, **kwargs): | |
total = 0 | |
t = time.time() | |
r = f(*args, **kwargs) | |
total += time.time() - t | |
if isinstance(r, types.GeneratorType): | |
try: | |
while 1: | |
t = time.time() |
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
def none_if_except(f, e=Exception): | |
try: | |
return f() | |
except e: | |
pass | |
def list_anyway(f, iterable): | |
values = [] | |
for i in iterable: |
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
void UExtendProceduralMeshLibrary::GenerateBoxMesh(FVector BoxSize, FIntVector BoxSegments, TArray<FVector>& Vertices, TArray<int32>& Triangles, TArray<FVector>& Normals, TArray<FVector2D>& UVs, TArray<FProcMeshTangent>& Tangents) | |
{ | |
BoxSize.X = abs(BoxSize.X); // width | |
BoxSize.Y = abs(BoxSize.Y); // height | |
BoxSize.Z = abs(BoxSize.Z); // depth | |
BoxSegments.X = BoxSegments.X < 1 ? 1 : BoxSegments.X; | |
BoxSegments.Y = BoxSegments.Y < 1 ? 1 : BoxSegments.Y; | |
BoxSegments.Z = BoxSegments.Z < 1 ? 1 : BoxSegments.Z; |
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 django.template.base import Node, Library, TemplateSyntaxError, Context | |
from django.template.loader import get_template | |
register = Library() | |
class WrapControlNode(Node): | |
"""Implements the actions of the wrap tag.""" | |
def __init__(self, filepath, nodelist): | |
self.filepath, self.nodelist = filepath, nodelist |
NewerOlder