Skip to content

Instantly share code, notes, and snippets.

@kalinchernev
kalinchernev / countries
Created October 6, 2014 09:42
Plain text list of countries
Afghanistan
Albania
Algeria
Andorra
Angola
Antigua & Deps
Argentina
Armenia
Australia
Austria
<div class="content clearfix">
<div>Comments :3</div>
<div class="media media--farnet">
<div class="media-body">
<div class="field field-name-field-ne-body field-type-text-with-summary field-label-hidden">
<div class="field-items">
<div class="field-item even">
<p>Body from Discussion in IT support</p>
</div>
</div>
@kalinchernev
kalinchernev / Form.class.php
Created January 20, 2014 11:14
Basic class to build a form from an array
<?php
/**
* Form Class
*
* Responsible for building forms
*
* @param array $elements renderable array containing form elements
*
* @return void
@kalinchernev
kalinchernev / collections.json
Created March 7, 2023 16:05
`npx @mocks-server/main mocks` on yarn install and run `mocks` as documented on mocks-server.org
[
{
"id": "get-result",
"routes": ["get-result:get-result-actual"]
}
]
@kalinchernev
kalinchernev / noselect.css
Created October 23, 2014 12:11
cross-browser way to disable highlighting selection
.noselect {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
#!/usr/bin/env node
'use strict';
var https = require('https');
var cheerio = require('cheerio');
var base = 'https://www.packtpub.com/'
var freeEbookURL = base + 'packt/offers/free-learning';

Visual mode

  • v: character
  • Shift + v: whole line
  • Ctrl + v: cursor, multiple lines

Navigation

  • h,j,k,l
  • f{c}: move to c character (useful for characters which would otherwise mess with / regex search: .,,,;,:, etc.)
@kalinchernev
kalinchernev / delete.mjs
Last active September 6, 2021 13:20
get and upload data to instagram
import Instagram from 'instagram-web-api';
(async () => {
const username = process.env.IG_USERNAME;
const password = process.env.IG_PASSWORD;
const client = new Instagram({ username, password });
await client.login();
const photos = await client.getPhotosByUsername({ username, first: 50 });
photos.user.edge_owner_to_timeline_media.edges.map(async edge => {
@kalinchernev
kalinchernev / rotate-screen.sh
Last active February 1, 2021 20:22 — forked from rubo77/rotate-screen.sh
Bind to a key to rotate the screen of a convertible laptop
#!/bin/bash
# This script rotates the screen and touchscreen input 90 degrees each time it is called,
# also disables the touchpad, and enables the virtual keyboard accordingly
# by Ruben Barkow: https://gist.github.com/rubo77/daa262e0229f6e398766
#### configuration
# find your Touchscreen and Touchpad device with `xinput`
TouchscreenDevice='Wacom ISDv4 E6 Finger touch'
TouchpadDevice='SynPS/2 Synaptics TouchPad'
@kalinchernev
kalinchernev / nest.js
Last active September 2, 2020 19:58
nest objects by 2 props: id and parent
const nest = (items, parent = 0) => {
const nested = [];
Object.values(items).forEach(item => {
// parent can be a string or a number
/* eslint-disable-next-line eqeqeq */
if (item.parent == parent) {
const children = nest(items, item.id);
if (children.length) {