Skip to content

Instantly share code, notes, and snippets.

View motionrus's full-sized avatar
🎯
Focusing

Ruslan Tiutin motionrus

🎯
Focusing
View GitHub Profile
// for detailed comments and demo, see my SO answer here http://stackoverflow.com/questions/8853396/logical-operator-in-a-handlebars-js-if-conditional/21915381#21915381
/* a helper to execute an IF statement with any expression
USAGE:
-- Yes you NEED to properly escape the string literals, or just alternate single and double quotes
-- to access any global function or property you should use window.functionName() instead of just functionName()
-- this example assumes you passed this context to your handlebars template( {name: 'Sam', age: '20' } ), notice age is a string, just for so I can demo parseInt later
<p>
{{#xif " name == 'Sam' && age === '12' " }}
BOOM
const URL = "http://localhost:8001/"
const USERNAME = "client"
const PASSWORD = "client"
const LOGIN_URL = URL + "api/api-auth/login/"
let AUTH = false
const cookieJar = pm.cookies.jar();
const getCSRFToken = () => {
const URL = "http://localhost:8000/"
const USERNAME = "client"
const PASSWORD = "client"
let AUTH = false
const cookieJar = pm.cookies.jar();
const getCSRFToken = () => {
pm.sendRequest("http://localhost:8000/login/", (error, response) => {
SELECT "api_thread"."id",
"api_thread"."conference_id",
"api_thread"."title",
"api_thread"."description",
"api_thread"."is_closed",
"api_thread"."is_pinned",
"api_thread"."post_moderation_allowed",
"api_thread"."has_voting",
"api_thread"."created_at",
"api_thread"."expired",
(venv) user@lnx-vdi-a034:~/Documents/Projects/ps_vk/backend$ pip3 install django-idm-permissions -i https://art.rd.aorti.ru/repository/stc8_py/simple --extra-index-url https://pypi.org/simple
Collecting django-idm-permissions
Exception:
Traceback (most recent call last):
File "/home/user/Documents/Projects/ps_vk/backend/venv/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/home/user/Documents/Projects/ps_vk/backend/venv/lib/python3.6/site-packages/pip/commands/install.py", line 353, in run
wb.build(autobuilding=True)
File "/home/user/Documents/Projects/ps_vk/backend/venv/lib/python3.6/site-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
import React, {useState} from "react"
import './App.css';
interface IBasicNumberInputProps {
value: number,
onChange: (value: number) => void,
}
function BasicNumberInput({value, onChange}: IBasicNumberInputProps) {
const [error, setError] = useState("");
import kerberos
service = "[email protected]"
initial_client_token="""YIIGHgYGKwYBBQUCoIIGEjCCBg6gDTALBgkqhkiG9xIBAgKiggX7BIIF92CCBfMGCSqGSIb3EgECAgEAboIF4jCCBd6gAwIBBaEDAgEOogcDBQAAAAAAo4IBsmGCAa4wggGqoAMCAQWhEBsOSU5ULkFPUlRJLlRFQ0iiLjAsoAMCAQOhJTAjGwRIVFRQGxsxcGtyb28tc3J2MDEuaW50LmFvcnRpLnRlY2ijggFfMIIBW6ADAgEgoQMCAQKiggFNBIIBST0SJbEBsicsuKGoaWAeyAMWwMj7uO15WJqe94Dm9IjWji9OkcUnDaLfaPI1TswsbyKQ6YHftTY4NcAYfewg5IdaskWY0c33aOPiG+EosAqC8pJMgTPSpMwc031YSOrdDPyyPG7OPm4eBpCOXtHW84JfVulbEp5gYcuQ/eB7xm9V9OWSgVpVsQEZEdZb96OT4WDUEXyPv4OjYJCxypgz7qlzTOL/zYUfuVIZhAz2Dz7/5nIhULcu7YFZAHa14MxHaN03uSXrrGUxPz8NRTl6TUUh78yIkOP5SJAsbJnnl7nrJEhP/p6bdPJ6Nd3UN4Vi4gJIN8oSp3FPTsWCw+CBYE7FUvkY8cgwDM/b3ZxAuxpED7vvBJJvgm5xkiffgAKLKKMjjr8WM6eh7qOeG2yPI/HLFpnc6GRpuoH1HK4XiZSslB/kETBOKmadpIIEETCCBA2gAwIBIKKCBAQEggQAaQBEUufG1ubkK3YNMLG0vVRvcPnaSEtjcAKlxMWi0qr+GoBz3c2sUvabmIz/KOJMEBkiHvYvqBRRh8HEqBeqHPSSRLNvLBdW4tW5mhE0JC20Eag13MftHHruzYgAWEyW5XNE2CSiM64ORpvD7Y5vRiAODHdXqHEqBAP/Us5MWIH0fvLWypDqQCuR2wN7BUqt9JykpHMnH+ajKczsdpo
from sqlalchemy import pool as alchemy_pool
import configparser, pymssql
PATH_TO_CONFIG = 'config_local.ini'
def get_db_config():
config = configparser.ConfigParser()
config.read(PATH_TO_CONFIG)
return config['DB.CONFIG']
import redis, json, pickle
r = redis.StrictRedis(host='localhost', port=6379, db=2)
def get_pretty_json():
for key in r.scan_iter("larix*"):
print (json.dumps(pickle.loads(r.get(key)), indent=4, sort_keys=True, ensure_ascii=False))
get_pretty_json()
import { useState } from 'react'
export default () => {
const [openItemId, setOpenItemId] = useState(null)
const toggleOpenItem = (id) => () => (openItemId === id ? setOpenItemId(null) : setOpenItemId(id))
return { openItemId, toggleOpenItem }
}