Skip to content

Instantly share code, notes, and snippets.

View lexuschert's full-sized avatar
:octocat:

Alexey Yakimov lexuschert

:octocat:
  • Mobile Solutions Ltd.
View GitHub Profile
@lexuschert
lexuschert / iterm2-solarized.md
Created August 7, 2022 15:30 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@lexuschert
lexuschert / fast_mask_for_string.cs
Last active September 5, 2021 09:26
Faster mask for string
/// Faster mask for string
/// Example: CreateMask("Password123")
/// Return: Pas********
///
/// https://www.youtube.com/watch?v=Kd8oNLeRc2c
///
public static string CreateMask(string stringValue) =>
string.Create(
stringValue.Length,
@lexuschert
lexuschert / codes.html
Created August 14, 2020 06:19
phone codes of countries (taked from web telegram)
<ul class="countries_modal_members_list">
<!----><li class="countries_modal_country_wrap clearfix" ng-repeat="country in countries | limitTo : slice.limit track by $index" style="">
<a class="countries_modal_country" ng-click="$close(country)">
<span class="countries_modal_country_code pull-right" ng-bind="country.code">+7 840</span>
<span class="countries_modal_country_name" ng-bind="country.name">Abkhazia</span>
</a>
</li><!----><li class="countries_modal_country_wrap clearfix" ng-repeat="country in countries | limitTo : slice.limit track by $index">
<a class="countries_modal_country" ng-click="$close(country)">
<span class="countries_modal_country_code pull-right" ng-bind="country.code">+7 940</span>
@lexuschert
lexuschert / getClientRectOffsetY.js
Created December 13, 2019 07:12
Get Client Rect Offset
function getClientRectOffsetY(elem, part, offset) {
elem = ge(elem);
offset = offset || 0;
var ey = getXY(elem)[1],
eh = getSize(elem)[1],
w = window, de = document.documentElement,
ch = Math.max(intval(w.innerHeight), intval(de.clientHeight)),
fixed_head = ge('page_header_cont'),
hh = getSize(fixed_head)[1],
st = (de.scrollTop || bodyNode.scrollTop || window.scrollY || 0);
@lexuschert
lexuschert / lang.js
Created December 13, 2019 06:56
Js. Lang utils
// Helper >
function isArray(obj) {
return Object.prototype.toString.call(obj) === '[object Array]';
}
// Helper />
function trim(text) {
return (text || '').replace(/^\s+|\s+$/g, '');
}
@lexuschert
lexuschert / utils.js
Last active December 13, 2019 06:38
Js utils
function replaceEntities(str) {
return se('<textarea>' + ((str || '').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;')) + '</textarea>').value;
}
function clean(str) {
return str ? (str+'').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;') : '';
}
function unclean(str) {
return replaceEntities((str+'').replace(/\t/g, "\n"));
@lexuschert
lexuschert / formatTime
Created December 13, 2019 06:32
formatTime
function formatTime(t) {
var res, sec, min, hour;
t = Math.max(t, 0);
sec = Math.round(t % 60);
res = (sec < 10) ? '0'+sec : sec;
t = Math.floor(t / 60);
min = t % 60;
res = min+':'+res;
t = Math.floor(t / 60);
@lexuschert
lexuschert / isRetina.js
Created December 13, 2019 06:31
Check isRetina screen
function isRetina() {
return window.devicePixelRatio >= 2;
}
@lexuschert
lexuschert / throttle.js
Created September 26, 2019 09:14
throttle
function throttle(func, ms) {
let isThrottled = false,
savedArgs,
savedThis;
function wrapper() {
if (isThrottled) { // (2)
savedArgs = arguments;
@lexuschert
lexuschert / meta-tags.md
Created March 29, 2019 10:50 — forked from whitingx/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>