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 / .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 / gulpfile.js
Created January 15, 2019 22:33
Gulp 4 - PostCSS wait for SASS compiler to write output files (File not found with singular glob)
/*
After migration to Gulp 4 and rewrite of gulpfile I have found out that gulp-sass plugin cannot
write compiled css files to disk before his task is resolved, even if the task is run in series()
call, causing unmatched glob pattern error. Usage of src(globs, { allowEmpty: true }) is not a
solution, because task must be run twice in order to output correct file.
..after few hours of despair and googling
*/
const { series, dest, src } = require('gulp')
@tvaliasek
tvaliasek / nextras.tempusdominus.init.js
Last active January 17, 2019 13:57
Nextras Forms tempus dominus datetime picker init
/**
* This file is part of the forked Nextras community extensions of Nette Framework
*
* @license MIT
* @link https://github.com/nextras/forms
* @author Jan Skrasek
* @author Tomas Valiasek
*/
// main init function, function is appended to $.fn
@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 */