Skip to content

Instantly share code, notes, and snippets.

View rendfall's full-sized avatar
💭
Coffee is a drink, not a language! ☕️

rendfall rendfall

💭
Coffee is a drink, not a language! ☕️
View GitHub Profile
@rendfall
rendfall / ES5 polyfills
Created June 24, 2015 21:12
List of basic ECMA262-5 methods [http://stackoverflow.com/a/2790686]
// copied from http://stackoverflow.com/a/2790686
'use strict';
// Add ECMA262-5 method binding if not supported natively
//
if (!('bind' in Function.prototype)) {
Function.prototype.bind= function(owner) {
var that= this;
if (arguments.length<=1) {
@rendfall
rendfall / getpreloader
Created April 13, 2015 09:03
Preloader helper
var getPreloader = function(dest, options){
options = $.extend({
alt: '',
css: {
display: 'block',
margin: '30px auto'
},
src: '/assets/ajax_loaders/loader-big.gif'
}, options);
@rendfall
rendfall / disable-close-window-hotkey
Created March 10, 2015 10:43
Disable close_window hotkey
// Preferences > Key Bindings - User
{ "keys": ["ctrl+shift+w"], "command": "noop"}
@rendfall
rendfall / repair-indent
Created March 10, 2015 10:42
SublimeText3 - Repair bad indentation
// required plugin: https://github.com/jisaacks/ChainOfCommand
// Preferences > Key Bindings - User
[
{ "keys": ["alt+shift+r"],
"command": "chain",
"args": {
"commands": [
["unindent", {
"context": [
@rendfall
rendfall / wp-getpostswithmeta.php
Created March 7, 2015 18:00
[WordPress] Get Posts with meta
function getPostsWithMeta() {
global $wpdb;
$query = "
SELECT DISTINCT
ID,
post_title,
post_date,
guid
FROM wp_posts
/**
* Queue System Object
*
* DOM structure requires some time to load,
* so we need to wait with events attachment.
* Queuing allows to manipulate functions call order
* properly.
*
* Important:
* Remember to add Queue.done() in the very end
@rendfall
rendfall / wp4.0-qtrans-fix
Last active August 29, 2015 14:16
WP 4.0 qTranslate FIX
// WP 4.0 qTranslate FIX
add_action( 'admin_init', 'custom_deregister_editor_expand' );
function custom_deregister_editor_expand() {
wp_deregister_script('editor-expand');
}
@rendfall
rendfall / mobileMenu
Created October 24, 2014 14:31
Mobile Menu Script (jQuery)
var mobileMenu = function() {
return {
$: null,
options: null,
openClass: 'open',
doAfter: function(){
if(typeof this.options.afterClick === 'function'){
this.options.afterClick();
}
},
<style>
.full-width { position: relative; width: 100%; height: 300px; }
.full-width:before { content: " "; display: block; position: absolute; width: 300%; height: 100%; left:-100%; background: inherit; z-index:-1; }
.full-width:after { content: " "; display: block; position: absolute; top:0; width: 100%; height: 100%; left:0; right: 0; margin: auto; z-index:-1;}
</style>
<div style="width:300px;min-height:600px;margin:0 auto">
<div class="full-width" style="background: #c0c0c0 url('http://lorempixel.com/1800/600/nature/1800x600/') no-repeat center top;">
<img alt="" src="http://placehold.it/300x300" style="opacity:0.8;"/>
</div>
@rendfall
rendfall / wordpress-usermanager
Created July 18, 2014 14:43
User Manager for Wordpress
if( ! get_role('simple_user')){
add_role(
'simple_user',
__( 'Użytkownik' ),
array(
'read' => true, // true allows this capability
)
);
}