Skip to content

Instantly share code, notes, and snippets.

View gleba's full-sized avatar

Gleb Y Panteleev gleba

View GitHub Profile
@gleba
gleba / jetton.js
Last active September 25, 2024 11:26
TON Jetton example
const TonWeb = require("tonweb");
const utils = require("tonweb/src/utils");
const NftUtils = require("tonweb/src/contract/token/nft/NftUtils");
const Cell = TonWeb.boc.Cell;
const { JettonMinter, JettonWallet } = TonWeb.token.jetton;
const jettonContentUri = 'https://files.raevskyschool.ru/coin.json';
async function doit() {
const tonweb = new TonWeb(new TonWeb.HttpProvider('https://testnet.toncenter.com/api/v2/jsonRPC', { apiKey: "get here: https://t.me/tontestnetapibot" }));
const WalletClass = tonweb.wallet.all['v3R2'];
@gleba
gleba / thing.VTL
Last active August 4, 2021 23:45
Typescript Model Sense Thing ( Apache Velocity File Template for WebStorm / intelli Idea)
#set($nameLower = ${NAME})
#set($nameLower = $nameLower.substring(0).toLowerCase())
#set($nameCapitalized = ${NAME})
import { MakeThing } from "lasens";
class ${nameCapitalized}Model {}
export const ${nameLower}Thing = MakeThing(${nameCapitalized}Model)
.controller((model) => {
@gleba
gleba / Welcome file.md
Created April 6, 2021 09:22
Welcome file

Welcome to StackEdit!

Hi! I'm your first Markdown file in StackEdit. If you want to learn about StackEdit, you can read me. If you want to play with Markdown, you can edit me. Once you have finished with me, you can create new files by opening the file explorer on the left corner of the navigation bar.

Files

StackEdit stores your files in your browser, which means all your files are automatically saved locally and are accessible offline!

Create files and folders

@gleba
gleba / verify.ts
Created August 20, 2019 08:42
openBracketsAreClosed
let haveABrackets = /[\[\]()<>]/
const openBracketsAreClosed = {
'(': /\(([^)]+)\)/,
'<': /<([^>]+)>/,
'[': /\[([^\]]+)]/,
}
const closeBrackets = {
'(': ")",
'<': ">",
@gleba
gleba / deep_search.py
Last active July 5, 2019 07:56
Поиск в тексте сайтов в выдаче гугла по запросу
from itertools import repeat
from bs4 import BeautifulSoup
from langdetect import detect
import requests
import hashlib
def page_to_text(url, deep_keys):
try:
page = requests.get(url)
monaco.languages.register({ id: 'mySpecialLanguage' });
monaco.languages.setMonarchTokensProvider('mySpecialLanguage', {
tokenizer: {
root: [
[/\?.?[a-z A-Z а-я А-Я 0-9$@?%*#№!_.,:]+/, "question"],
[/\extract_.?[a-z_]+/, "extract"],
[/\$.?[a-z_]+/, "var"],
[/[>-]/, "operator"],
[/^(.*?)\:/, "condition"],
[/\[[a-zA-Z 0-9:]+\]/, "custom-date"],
@gleba
gleba / jira_logtime.py
Created January 28, 2019 08:49
JIRA Time Logger
from jira import JIRA
from dateutil import parser
import datetime
options = {
'server': 'https://datamonsters.atlassian.net'
}
jira = JIRA(options, basic_auth=('gpanteleev@datamonsters.co', '....XXX....'))
issues = jira.search_issues('updated >= 201X-XX-01 AND assignee in (gpanteleev)',
@gleba
gleba / build.gradle
Created May 15, 2015 19:01
gradlefx-groovy
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath group: 'org.gradlefx', name: 'gradlefx', version: '1.2.0'
classpath 'com.android.tools.build:gradle:0.4'
}
@gleba
gleba / DataCollection
Last active August 29, 2015 14:12
Реализуйте структуру данных, обладающую преимуществами hash-map (быстрый доступ к элементам за O(1)) и array (размер, упорядоченный обход всех элементов и доступ по индексу).
package {
import flash.utils.Dictionary;
import flash.utils.Proxy;
import flash.utils.flash_proxy;
use namespace flash_proxy;
public class DataCollection extends Proxy {
public function DataCollection(identityFieldName:String) {
indexes = new Vector.<int>();
@gleba
gleba / gist:bbac97ed8ea784cf14e1
Created December 26, 2014 21:29
Напишите функцию, которая из входящего массива целых чисел выберет все возможные сочетания чисел, сумма которых будет равняться заданному числу. Входящий массив содержит не больше 20 чисел.
//f([1,3,5], 4)
//f([1,2,5,2], 4)
//f([1,2,3,4,5,6,7,8,9,10,11], 10);
//f([9,3,1,4,7,6,5,8,2,19,11], 10);
//f([1,2,3,4,5,6,7,8,9,10,11,12,14], 30);
var k:int = 20;
var va:Array = [];
while(k--){
va.push(int(Math.random()*20));