Skip to content

Instantly share code, notes, and snippets.

View brihter's full-sized avatar

Bostjan Rihter brihter

  • Internet
View GitHub Profile
@brihter
brihter / mysql_maintenance.sh
Last active December 19, 2015 21:09
MySQL maintenance snippets
##########
# EXPORT #
##########
# export db (schema only)
mysqldump -u username -ppassword --no-data --add-drop-database --databases db > db.sql
# export db
mysqldump -u username -ppassword --add-drop-database --databases db > db.sql
@brihter
brihter / Paging.override.js
Created August 7, 2013 16:06
A ExtJS paging toolbar component override to allow for showing/hiding the refresh button in the toolbar. Compatible with version Ext 4.2.0.
/**
* A paging toolbar override to allow for hiding the refresh button in the toolbar. Compatible with Ext 4.2.0.
*
* @class Ext.toolbar.Paging
* @override
* @author Bostjan Rihter <bostjan.rihter@gmail.com>
*/
Ext.override(Ext.toolbar.Paging, {
/**
* @cfg {Boolean} enableRefresh
@brihter
brihter / Paging.override.js
Created August 7, 2013 18:39
A ExtJS paging toolbar component override to allow for showing/hiding the refresh button in the toolbar. Compatible with version Ext 4.2.1.
/**
* A paging toolbar override to allow for hiding the refresh button in the toolbar. Compatible with Ext 4.2.1.
*
* @class Ext.toolbar.Paging
* @override
* @author Bostjan Rihter <bostjan.rihter@gmail.com>
*/
Ext.override(Ext.toolbar.Paging, {
/**
* @cfg {Boolean} enableRefresh
@brihter
brihter / Paging.override.js
Created August 7, 2013 18:49
An ExtJS paging toolbar override that fixes the incorrect paging behaviour in an edge case. Compatible with ExtJS 4.2.1.
/**
* A paging toolbar override that fixes the incorrect paging behaviour when navigating
* to a certain page (where page no. > 1), doing a remote load of data (i.e.: filtering
* data) and size of the remote data is less than store's defined pageSize.
*
* Compatible with ExtJS 4.2.1.
*
* @class Ext.toolbar.Paging
* @override
* @author Bostjan Rihter <bostjan.rihter@gmail.com>
@brihter
brihter / oracle_maintenance.sql
Last active December 20, 2015 20:39
Oracle maintenance snippets
-- backup table
create table TABLE_NAME_BACKUP as select * from TABLE_NAME;
create table user_20130809 as select * from user;
create table role_20130809 as select * from role;
create table function_20130809 as select * from function;
-- disable constraints
-- disable all constraints
begin
@brihter
brihter / oracle_snippets.sql
Last active April 10, 2018 07:22
Oracle snippets
-- create table
create table "TABLE_NAME"
(
"ID" NUMBER(9, 0) NOT NULL,
"COL_1" VARCHAR2(32) NULL,
"COL_2" DATE NULL,
"COL_3" NVARCHAR2(2000) NULL,
"COL_4" NUMBER(9, 0) NOT NULL,
constraint "PK_TABLE_NAME" PRIMARY KEY ("ID")
);
@brihter
brihter / mysql_partitioning.sql
Last active December 21, 2015 08:49
MySQL partitioning snippets (assuming MyISAM engine).
-- create a partitioned table
-- use a default (unused) value for a dummy initial partition when dynamically adding more
create table `TABLE` (
`id` int(10) not null,
...
)
collate='utf8_general_ci'
engine=MyISAM
partition by list (id)
(
@brihter
brihter / opencart_fix_indexes.sql
Last active September 19, 2023 11:26
The script will generate the missing opencart indexes. Copy the result and execute it on the target schema.
use information_schema;
select
concat('alter table `', c.table_name, '` add index `ix_', c.column_name, '` (`',c.column_name,'`);')
from columns c
where c.table_schema = 'SCHEMA_NAME'
and lower(c.column_name) like '%_id%'
and c.column_key = '';
@brihter
brihter / ext3_object.snippet
Created May 6, 2014 14:20
ExtJS 3.x Visual Studio snippets
<CodeSnippet Format="1.1.0" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<Header>
<Title>ext3_object</Title>
<Author>Bostjan Rihter</Author>
<Shortcut>ext3_object</Shortcut>
<Description>ExtJS object snippet</Description>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
@brihter
brihter / vbox_management
Last active August 29, 2015 14:03
resize virtualbox image
# resize
# 25600 = 25 * 1024MB
VBoxManage clonehd "NAME.vmdk" "NAME_CLONE.vdi" --format vdi
VBoxManage modifyhd "NAME_CLONE.vdi" --resize 25600
VBoxManage clonehd "NAME_CLONE.vdi" "NAME1.vmdk" --format vmdk
# download gparted iso and mount it in virtualbox
# extend the partition in gparted, apply changes
# unmount the iso