Skip to content

Instantly share code, notes, and snippets.

@fprochazka
fprochazka / ajax.overlay.js
Created May 17, 2014 12:59
Overlay-on-ajax extension for nette.ajax.js
(function ($) {
$.nette.ext('overlay', {
before: function (xhr, settings) {
if (!settings.nette || !settings.nette.el) {
return;
}
var tar = $(settings.nette.el);
var container = tar.closest('.ajax-overlay');
@klokan
klokan / google-maps-places-api-v3-autocomplete-select-first-option-on-enter.js
Created January 13, 2014 21:20
Google Maps Places API V3 autocomplete select first option on Enter
var searchBox = new google.maps.places.SearchBox(document.getElementById('searchinput'));
google.maps.event.addListener(searchBox, 'places_changed', function() {
var place = searchBox.getPlaces()[0];
if (!place.geometry) return;
if (place.geometry.viewport) {
map.fitBounds(place.geometry.viewport);
} else {
@mbohovic
mbohovic / custom.netteForms.css
Last active December 30, 2015 22:29
Custom netteForms.js - show alert messages for Nette Framework
.form-alert {
position: relative;
top: 0;
left: 0;
z-index: 1010;
max-width: 276px;
padding: 1px;
text-align: left;
white-space: normal;
color: #b94a48;
@milo
milo / .autoprepend.php
Created August 20, 2013 07:51
Handy Tracy/Nette Debugger in autoprepend file
<?php
function __nette($version = NULL) {
if ($version) {
require "/var/www/lib/nette/$version/Nette/loader.php";
} else {
require '/var/www/dev/nette/Nette/loader.php';
}
}
@dobbyloo
dobbyloo / CustomPost.php
Last active September 28, 2021 13:53
Wordpress: custom post wrapper class for "register_post_type" function.
<?php namespace PaintedCloud\WP\Classes;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class CustomPost {
protected $textdomain;
protected $posts;
public function __construct( $textdomain )
@ostryweb-cz
ostryweb-cz / plugin.php
Created December 29, 2012 11:27
wordpress custom post type example czech blog.ostryweb.cz
function muj_add_post_type() {
register_post_type( 'muj_document',
array(
'labels' => array(
'name' => 'Dokument',
'singular_name' => 'Dokument',
'add_new' => 'Přidat dokument',
'add_new_item' => 'Přidat nový dokument',
'edit' => 'Upravit',
'edit_item' => 'Upravit dokument',
@fprochazka
fprochazka / BasePresenter.php
Created October 6, 2012 16:22
Image pipe for #nettefw templates
<?php
/**
* @author Filip Procházka <[email protected]>
*/
abstract class BasePresenter extends Nette\Application\UI\Presenter
{
/**
* @var \Img\ImagePipe
@mauryaratan
mauryaratan / htaccess-tweaks
Created May 7, 2012 13:43
htaccess Gzip Compression and expires to speed up page load time
<IfModule mod_deflate.c>
#The following line is enough for .js and .css
AddOutputFilter DEFLATE js css
AddOutputFilterByType DEFLATE text/plain text/xml application/xhtml+xml text/css application/xml application/rss+xml application/atom_xml application/x-javascript application/x-httpd-php application/x-httpd-fastphp text/html
#The following lines are to avoid bugs with some browsers
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>
@franz-josef-kaiser
franz-josef-kaiser / pagination.php
Created February 9, 2011 13:23
WordPress pretty Pagination with first/last, next/prev and range parameters above/below current page
- MOVED -
Can now be found in a repository incl. license, readme, styles and plugin php file: https://github.com/franz-josef-kaiser/Easy-Pagination-Deamon
@Aurielle
Aurielle / BasePresenter.php
Created January 18, 2011 19:33
Koncept n:if-allowed (ověřování ACL v šablonách - Nette Framework) - funkční pouze s n:href
<?php
/*
* Předpokládá ACL následujícího tvaru:
* resource: Jméno presenteru / komponenty (PHP, včetně namespace)
* privilege: Jméno akce / signálu
*/
public function userAllowed($component, $destination = NULL)
{
if($destination === NULL) // No destination specified, can cause unexpected results when used with n:if-allowed as it would check for previous link!