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 / 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 / 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 / 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 / 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 / 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 / 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 / view.php
Created May 24, 2017 17:40
Replace param in URL for form usage in Yii 1.1.*
<?php
/** @var array $params Current get params without c **/
$params = $_GET;
unset( $params[ 'c' ] );
/** @var string $url **/
$url = Yii::app()->controller->createUrl( Yii::app()->controller->id . '/' . Yii::app()->controller->action->id, $params );
/**
* Create form with nedded c param included.
@fedek6
fedek6 / keyboard.ino
Created April 11, 2017 09:02
Simple keyboard implementation for Arduino
/**
* Arduino USB HID Keyboard Demo
* Keys 1, 2, 3 and 4 on pins 4, 5, 6 and 7
*
* @info check details on my website
* @link http://blog.realhe.ro
*/
uint8_t buf[8] = {
0 }; /* Keyboard report buffer */
@fedek6
fedek6 / gist:f3dfa011f01c1addce38bb9ecd10dda2
Created April 10, 2017 11:55
Get all PostgreSQL databases and their sizes
psql -c "SELECT pg_database.datname, pg_database_size(pg_database.datname), pg_size_pretty(pg_database_size(pg_database.datname)) FROM pg_database ORDER BY pg_database_size DESC;" -d <db_name> <db_user>
@fedek6
fedek6 / web.config
Created March 15, 2017 15:21
Protect Wordpress on MS IIS, say hello to Turkish hackers :)
<rules>
<clear />
<rule name="Protect WP" stopProcessing="true">
<match url="(readme.html)|(xmlrpc.php)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="https://youtu.be/Ww0k-80n-zI" />
</rule>
</rules>