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
// First, checks if it isn't implemented yet. | |
if (!String.prototype.format) { | |
String.prototype.format = function() { | |
var args = arguments; | |
return this.replace(/{(\d+)}/g, function(match, number) { | |
return typeof args[number] != 'undefined' | |
? args[number] | |
: match | |
; | |
}); |
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
86937 isset | |
43159 echo | |
31697 empty | |
29252 substr | |
26146 count | |
24248 is_array | |
22572 strlen | |
19365 sprintf | |
18090 unset | |
16584 str_replace |
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 random | |
# используемые символы | |
chars = 'abcdefghyjklmnopqrstuvwxyz' | |
chars += chars.upper() | |
nums = str(1234567890) | |
chars += nums | |
special_chars = '!@#$%^&*()_+-' | |
chars += special_chars |
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 __future__ import unicode_literals | |
import youtube_dl | |
def progress_hook(d): | |
if(d['status'] == "downloading"): | |
print(f'{d["_speed_str"]} ({d["_percent_str"]})') | |
else: | |
print("Готово!") | |
ydl_opts = { |
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 datetime import date | |
import calendar | |
import locale | |
locale.setlocale(locale.LC_ALL, 'ru_RU') | |
today = date.today() | |
print("Сегодня {}й день недели, {}!".format( | |
today.weekday(), | |
calendar.day_name[today.weekday()])) |
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 cv2 | |
import sys | |
imgPath = input("Введите путь к картинке:") | |
faceCascade = cv2.CascadeClassifier( | |
cv2.data.haarcascades+'haarcascade_frontalface_default.xml') | |
img = cv2.imread(imgPath) | |
imgGray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) |
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
using UnityEditor; | |
using UnityEngine; | |
using DG.Tweening; | |
/// <summary> | |
/// Attribute to select a single layer. | |
/// </summary> | |
public class LayerAttribute : PropertyAttribute | |
{} |
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
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using DG.Tweening; | |
[ExecuteInEditMode] | |
public class GD3DCameraFollow : MonoBehaviour | |
{ | |
[SerializeField] | |
private Transform playerTransform; |
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 naive_find_top_k(values, k=20): | |
values.sort(reverse=True) | |
return values[:k] | |
import heapq | |
def heap_find_top_k(values, k=20): | |
return heapq.nlargest(k, values) | |
import random |
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
/* Лол, код из архива - файл датируется 2017 годом. | |
Написан был после недели изучения C++. | |
Реализует серверную часть чата на клиенте. | |
Код не полный, писался на скорую руку - так сказать proof of concept. | |
О, и да - семафоры это круто :3 */ | |
#include <iostream> | |
#include <string> | |
#include <stdio.h> | |
#include <cstring> | |
#include <stdlib.h> |
OlderNewer