Skip to content

Instantly share code, notes, and snippets.

View fedek6's full-sized avatar
🎯
Focusing

Konrad Fedorczyk fedek6

🎯
Focusing
View GitHub Profile
@fedek6
fedek6 / benchmark.php
Last active June 8, 2017 12:52
Benchmark method taken from Instant Share app
<?php
/**
* Benchmark
*
* @category debug
*/
public function benchmark() {
/** @var integer $timeStart **/
$timeStart = microtime(true);
@fedek6
fedek6 / dummy_download.php
Created July 28, 2017 13:45
Dummy download tester for PHP with data throttling
<?php
/**
* Long file download tester.
* You can test very long file downloads using PHP.
*/
ob_start();
/**
* Settings
*/
@fedek6
fedek6 / backup.sh
Last active October 18, 2017 18:10
Simple backup script for web projects.
#!/bin/sh
# Path
result=${PWD##*/}
# Current date
now=$(date +"%d_%m_%Y")
machine=$(hostname)
# Database credentials
@fedek6
fedek6 / removeSublimeContextMenu.bat
Created November 9, 2017 12:30
Remove Sublime integration added by: roundand/OpenWithSublimeText3.bat
@echo off
rem add it for all file types
@reg delete "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /f
rem add it for folders
@reg delete "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /f
pause
@fedek6
fedek6 / Gruntfile.js
Last active November 12, 2017 13:55
Grunt file designed for e-mail HTML creation.
module.exports = function (grunt) {
grunt.initConfig({
/**
* Prepare banner.
* This will be used as header for generated files.
*/
pkg: grunt.file.readJSON('package.json'),
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> ' + '<%= grunt.template.today("yyyy-mm-dd h:MM:ss") %>' + '*/' + "\n",
/* Minify html */
@fedek6
fedek6 / functions.php
Created March 13, 2018 09:56
Ajax support for WP Newsletter plugin (https://www.thenewsletterplugin.com)
<?php
/** @constant string THEME_NAME **/
define( 'THEME_NAME', get_option('stylesheet') );
/**
* Custom script
*/
function my_scripts_method() {
wp_enqueue_script(
'custom-script',
@fedek6
fedek6 / glitcher.js
Created May 14, 2018 10:16
Glitch website using jQuery
$.fn.glitchMode = function() {
var glitches = {
/**
* Random color
*/
color: function(e) {
var color ='#'+Math.random().toString(16).substr(2,6);
e.css('color', color );
},
@fedek6
fedek6 / web.php
Created May 21, 2018 09:57
Debug information about rendered template in Yii2
<?php
$config = [
'components' => [
'view' => [
'on afterRender' => function ($event) {
// Check if this is not a layout file
if( preg_match( '/layouts/', $event->viewFile ) == 0 ) {
/**
* Add template info.
*/
@fedek6
fedek6 / bootstrap.js
Created May 21, 2018 12:41
jQuery basic bootstrap
(function ($, root, undefined) {
/**
* Onready – fire when DOM is ready
*/
$(function () {
'use strict';
// say hello
console.log('Hello, Want to hire me? Go to: http://realhe.ro');
@fedek6
fedek6 / backup_pg.ps1
Created June 4, 2018 12:20
PowerShell script for Posgres backup. Support for multiple databases.
#Global config (always uncommented)
$PG_BIN = "C:\Program Files\PostgreSQL\9.6\bin\pg_dump.exe"
$PG_HOST=$env:COMPUTERNAME
$PG_PORT=5432
$PG_PATH="C:\inetpub\temporary_backups"
$ZIP_BIN="C:\Program Files\7-Zip\7z.exe"
#----------------------------------------
#Database config for (uncomment if manual use)