Skip to content

Instantly share code, notes, and snippets.

View adamkudrna's full-sized avatar
🙈

Adam Kudrna adamkudrna

🙈
View GitHub Profile
@adamkudrna
adamkudrna / email.js
Last active August 29, 2015 14:08
Insert @ into blank email inputs on focus if empty
/**
* Insert @ into blank email inputs on focus if empty.
*/
$('input[type="email"]').focus(function() {
var input = $(this);
if (!input.val()) {
input.val('@');
}
}).blur(function() {
var input = $(this);
@adamkudrna
adamkudrna / map.js
Last active August 29, 2015 14:10
Responsive customised Google map
/**
* Initialize and render customized Google map.
*/
'use strict';
var mapRendered = false;
function Map() {}
@adamkudrna
adamkudrna / Gruntfile.js
Last active August 29, 2015 14:10
Starter Gruntfile
'use strict';
module.exports = function (grunt) {
var options = {
pkg: grunt.file.readJSON('package.json'),
paths: {
src: 'assets',
dist: 'www',
@adamkudrna
adamkudrna / .htaccess
Created December 8, 2014 20:30
Caching and compression
# ------------------------------------------------------------------------------
# | Better website experience |
# ------------------------------------------------------------------------------
# Force Internet Explorer to render pages in the highest available
# mode in the various cases when it may not.
# https://hsivonen.fi/doctype/#ie8
@adamkudrna
adamkudrna / scrolling.js
Created December 17, 2014 00:32
Animated scrolling
// Scrolling
function scrollToElement(element, offset) {
var offsetTop = $(element).offset().top;
if (arguments.length === 2) {
offsetTop += offset;
}
$('html, body').animate({ scrollTop: offsetTop }, 500);
}
// Scroll to content
@adamkudrna
adamkudrna / hires.css
Created March 9, 2015 14:19
Hi-dpi/retina media query
@media (min-resolution: 144dpi), (-webkit-min-device-pixel-ratio: 1.5) {
}
@adamkudrna
adamkudrna / drupal.js
Created April 21, 2015 08:33
Drupal and custom jQuery JS
(function ($) {
$(document).ready(function(){
// Your code goes here!
});
}(jQuery));
@adamkudrna
adamkudrna / browserSync.js
Created May 22, 2015 18:39
BrowserSync + Tracy
'use strict';
module.exports = {
dev: {
bsFiles: {
src : [
'<%= paths.dist %>/css/*.css',
'<%= paths.dist %>/js/*.js',
'<%= paths.dist %>/images/**/*.svg',
@adamkudrna
adamkudrna / web.config
Created June 12, 2015 23:33
IIS deny from all 401
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<security>
<authorization>
<remove users="*" roles="" verbs="" />
<add accessType="Allow" roles="Administrators" />
</authorization>
</security>
</system.webServer>
@adamkudrna
adamkudrna / bootstrap-fix.less
Last active August 29, 2015 14:24
Bootstrap 2 + current LESS
// Fix old LESS syntax in Bootstrap 2.
#grid {
.core {
.span (@columns) {
width: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns - 1));
}
}
}