Skip to content

Instantly share code, notes, and snippets.

View arfeo's full-sized avatar
:octocat:
Githubing little by little

Leonid Belikov arfeo

:octocat:
Githubing little by little
View GitHub Profile
@arfeo
arfeo / TableExport.md
Created September 4, 2018 14:03
PHPExcel table export class
class TableExport {
    private $head;
    private $body;
    private $sheet_title;
    private $sheet_subject;

    /**
     * TableExport constructor
     *
@arfeo
arfeo / Charset.md
Created August 27, 2018 14:42
Oracle: change database character set

Change database character set

$ sqlplus / as sysdba

SQL> SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER SYSTEM ENABLE RESTRICTED SESSION;
ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
ALTER SYSTEM SET AQ_TM_PROCESSES=0;
@arfeo
arfeo / Backup.md
Created August 27, 2018 14:40
Oracle: database backup w/ RMAN

Database backup w/ RMAN

$ rman target /

RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/home/oracle/backup/rman/full_%u_%s_%p';
RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
RMAN> run
2> {
3> shutdown immediate
@arfeo
arfeo / gist:0e4f79956cf164ed41926b09c9d0b622
Created August 27, 2018 14:36
Oracle: full text search in all tables
create or replace procedure whereIsValue(valueParam varchar2)
AS
TYPE VALCUR IS REF CURSOR;
cursor tabl is select table_name from user_tables;
cursor col (tablename varchar2) is select column_name
from user_tab_columns
where table_name like tableName;
valueCursor VALCUR;
tableName varchar2(50);
columnName varchar2(50);
@arfeo
arfeo / Migrate.md
Last active August 27, 2018 14:37
Migrating a cloned repo to GitHub

Migrating a cloned repo to GitHub

$ cd /path/to/repo

$ git fetch --prune

$ git push --prune https://github.com/{USERNAME}/{NEW_REPO_NAME}.git +refs/remotes/origin/*:refs/heads/* +refs/tags/*:refs/tags/*

Changing the Git history of a repo

@arfeo
arfeo / gist:0502f6b84e4338470beede7c2b4788f9
Last active March 25, 2019 13:08
[JS] One function markdown processing (live @ http://arfeo.net/tests/mips/)
const markdownProcessing = (source) => {
let proc = source;
// Headers
proc = proc.replace(/(^|[^#])# (.*)/gui, '$1<h1>$2</h1>');
proc = proc.replace(/(^|[^#])## (.*)/gui, '$1<h2>$2</h2>');
proc = proc.replace(/(^|[^#])### (.*)/gui, '$1<h3>$2</h3>');
proc = proc.replace(/(^|[^#])#### (.*)/gui, '$1<h4>$2</h4>');
proc = proc.replace(/(^|[^#])##### (.*)/gui, '$1<h5>$2</h5>');
proc = proc.replace(/(^|[^#])###### (.*)/gui, '$1<h6>$2</h6>');
#! /bin/sh
tmp_pwd=`pwd`
cd /Applications/Momentics.app && source bbndk-* && cd $tmp_pwd
QNX_BINS="${QNX_HOST}/usr/bin"
./configure CC="${QNX_BINS}/qcc" CXX="${QNX_BINS}/qcc" \
LDFLAGS="-Vgcc_ntoarmv7le" RANLIB="ntoarmv7-ranlib" AR="ntoarmv7-ar" \
CFLAGS="-Vgcc_ntoarmv7le" \
@arfeo
arfeo / gist:10b49aa472a04342a3223de747631e4f
Created March 21, 2018 09:12
[ES6] Text editor w/ text coloring
const codeEditor = document.getElementById('codeEditor');
/**
* Insert html at the caret position
*/
const insertHTML = html => {
const sel = window.getSelection();
if (sel.getRangeAt && sel.rangeCount) {
@arfeo
arfeo / gist:8bc289b8791d4e6cc2435fbed459da40
Created March 20, 2018 22:17
[ES6] Set caret to the end of text input
const setCaretToTheEnd = el => {
el.focus();
if (typeof window.getSelection != "undefined"
&& typeof document.createRange != "undefined") {
const range = document.createRange();
range.selectNodeContents(el);
range.collapse(false);
const sel = window.getSelection();
sel.removeAllRanges();
@arfeo
arfeo / gist:72fb028add3eceaec3d034b3a304aabe
Last active September 13, 2018 13:00
[ES6] Long tap event handler
/**
*
* Обработчик длительного касания
*
* @param {Function} action Вызываемая функция
* @param {Integer} duration Длительность касания в мс (1000 по умолчанию)
*
* ---
*
* Пример использования: