Skip to content

Instantly share code, notes, and snippets.

View VladimirPal's full-sized avatar
💭
I may be slow to respond.

Vladimir VladimirPal

💭
I may be slow to respond.
View GitHub Profile
@VladimirPal
VladimirPal / delay_search_input.coffee
Last active August 29, 2015 14:16
Delay search input
delay_search_input: (ev) ->
ev.preventDefault()
clearTimeout(@delay_id)
@delay_id = _.delay () =>
value = $(ev.target).val()
,1500
events:
"blur form input": "validateInput"
validateInput: (ev) ->
$input = $(ev.target)
input_name = $(ev.target).attr 'name'
input_value = $(ev.target).val()
if input_value.length
@model.set input_name, input_value
@model.isValid input_name
from flask.ext.restful import marshal_with
from flask.ext.jwt import current_user
from functools import wraps
class marshal_rm_role(object):
def __init__(self, fields, role, remove_fields):
self.fields = fields
self.role = role
self.remove_fields = remove_fields
@VladimirPal
VladimirPal / alembic_default_value.py
Last active April 1, 2024 19:14
default value alembic
# Boolean
op.add_column('projects', sa.Column('is_closed', sa.Boolean(), server_default=sa.schema.DefaultClause("0"), nullable=False))
# DateTime
op.add_column('projects_users', sa.Column('created_at', sa.DateTime(), server_default=sa.func.current_timestamp(), nullable=False))
@VladimirPal
VladimirPal / neomuttrc
Last active October 20, 2024 03:16
Minimal neomutt config for gmail imap
set imap_user="[email protected]"
set imap_pass=`/usr/bin/security find-generic-password -w -a '[email protected]' -s 'Gmail'`
set folder=imaps://imap.gmail.com/
set spoolfile=+INBOX
set record="+[Gmail]/Sent Mail"
set postponed="+[Gmail]/Drafts"
# https://www.neomutt.org/guide/reference search sleep_time for additional info
set sleep_time=0 # be faster
@VladimirPal
VladimirPal / 24-bit-color.sh
Last active September 25, 2022 12:14 — forked from lifepillar/24-bit-color.sh
Test 24 bit colors in terminals
#!/bin/bash
#
# This file echoes a bunch of 24-bit color codes
# to the terminal to demonstrate its functionality.
# The foreground escape sequence is ^[38;2;<r>;<g>;<b>m
# The background escape sequence is ^[48;2;<r>;<g>;<b>m
# <r> <g> <b> range from 0 to 255 inclusive.
# The escape sequence ^[0m returns output to default
setBackgroundColor()