Skip to content

Instantly share code, notes, and snippets.

View tvaliasek's full-sized avatar

Tomáš Valiašek tvaliasek

View GitHub Profile
@tvaliasek
tvaliasek / HmpsetPresenter.php
Last active August 29, 2015 14:14
nette2 - phpseclib handle
<?php
namespace App\AdminModule\Presenters;
use Nette,
App\Model,
Nette\Application\Responses,
Net_SSH2, //pear phpseclib 0.3.9. composer: phpseclib/phpseclib
Net_SCP;
@tvaliasek
tvaliasek / same-height-col-content
Created February 13, 2015 14:47
jQuery fix for same height items in row
/*
* example of html structure:
*
* <div class="row row-same-height">
* <div class="col-sm-6 col-xs-12">
* <div class="same-height-item">...</div>
* </div>
* <div class="col-sm-6 col-xs-12">
* <div class="same-height-item">...</div>
* </div>
@tvaliasek
tvaliasek / emailObfuscation
Created February 13, 2015 14:57
Simple jQuery email obfuscation function
/*
* Simple jQuery function for email obfuscation
*
*<a href="mailto:some#zavinac#email.cz" target="_blank" title="Email link">some#zavinac#email.cz</a>
*
*/
jQuery(function(){
$("a[href^='mailto:']").each(function(){
var $repl = $(this).attr('href');
@tvaliasek
tvaliasek / _awesomplete.scss
Created May 27, 2016 10:16
SCSS partial for styling awesomplete.js autocomplete plugin
$aw_list_bg_color: $white;
$aw_list_border: none;
$aw_list_shadow: .05em .2em .6em rgba(0,0,0,.2);
$aw_list_radius: 0px;
$aw_list_color: $darkGray;
$aw_selected_item_bg: $blue;
$aw_selected_item_color: $white;
$aw_mark_bg: $lightBlue;
$aw_mark_color: $white;
$aw_selected_mark_bg: rgba($white, 0.15);
@tvaliasek
tvaliasek / .htaccess
Created June 28, 2016 20:37 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
<?php
namespace App\Model;
use Nette,
Nette\Utils\Strings,
Nette\Database\Connection;
class GopayAPI extends Nette\Object {
@tvaliasek
tvaliasek / main.js
Created June 5, 2018 20:09
electron axios stream download with progress
import {ipcMain} from 'electron'
const fs = require('fs')
const axios = require('axios')
/* ... */
ipcMain.on('downloadFile', function (event, data) {
const filePath = data.filePath
const item = data.item
@tvaliasek
tvaliasek / .htaccess
Created July 10, 2018 15:35
htaccess expire headers and gzip compression
# enable gzip compression
<IfModule mod_deflate.c>
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript text/javascript application/javascript application/json
</IfModule>
</IfModule>
# ----------------------------------------------------------------------
# Expires headers (for better cache control)
# ----------------------------------------------------------------------
@tvaliasek
tvaliasek / ADClient.js
Last active March 30, 2022 18:40
node activedirectory - check if user is locked, disabled or expired and get date of last password change
/*
To get some attributes from AD, you need to set the correct permissions on the container
or object you are trying to read. (e.g., pwdLastSet, userAccountControl)
*/
const ActiveDirectory = require('activedirectory')
/* eslint-disable-next-line no-unused-vars */
const SCRIPT_FLAG = 0
const ACCOUNTDISABLE_FLAG = 1
/* eslint-disable-next-line no-unused-vars */
@tvaliasek
tvaliasek / recaptcha.invisible.ajax.js
Last active October 24, 2022 12:38
AJAX invisible recaptcha for uestla/recaptchacontrol
/**
* This file is part of the ReCaptchaControl package
*
* !!! needs polyfill for FormData in IE11 and Edge !!!
* https://github.com/jimmywarting/FormData
*
* @license MIT
* @author Petr Kessler (https://kesspess.cz)
* @link https://github.com/uestla/ReCaptchaControl
*/