Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Konrad fedek6

🎯
Focusing
View GitHub Profile
@fedek6
fedek6 / glitcher.js
Created May 14, 2018
Glitch website using jQuery
View glitcher.js
$.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 / functions.php
Created Mar 13, 2018
Ajax support for WP Newsletter plugin (https://www.thenewsletterplugin.com)
View functions.php
<?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 Nov 12, 2017
Grunt file designed for e-mail HTML creation.
View Gruntfile.js
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 Nov 9, 2017
Remove Sublime integration added by: roundand/OpenWithSublimeText3.bat
View removeSublimeContextMenu.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 Oct 18, 2017
Simple backup script for web projects.
View backup.sh
#!/bin/sh
# Path
result=${PWD##*/}
# Current date
now=$(date +"%d_%m_%Y")
machine=$(hostname)
# Database credentials
@fedek6
fedek6 / dummy_download.php
Created Jul 28, 2017
Dummy download tester for PHP with data throttling
View dummy_download.php
<?php
/**
* Long file download tester.
* You can test very long file downloads using PHP.
*/
ob_start();
/**
* Settings
*/
@fedek6
fedek6 / benchmark.php
Last active Jun 8, 2017
Benchmark method taken from Instant Share app
View benchmark.php
<?php
/**
* Benchmark
*
* @category debug
*/
public function benchmark() {
/** @var integer $timeStart **/
$timeStart = microtime(true);
@fedek6
fedek6 / view.php
Created May 24, 2017
Replace param in URL for form usage in Yii 1.1.*
View view.php
<?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 Apr 11, 2017
Simple keyboard implementation for Arduino
View keyboard.ino
/**
* 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 Apr 10, 2017
Get all PostgreSQL databases and their sizes
View gist:f3dfa011f01c1addce38bb9ecd10dda2
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>