Skip to content

Instantly share code, notes, and snippets.

@cferdinandi
cferdinandi / myplugin-media.js
Last active December 6, 2023 14:23
Adding a Media Uploader to a custom metabox
/**
* Load media uploader on pages with our custom metabox
*/
jQuery(document).ready(function($){
'use strict';
// Instantiates the variable that holds the media library frame.
var metaImageFrame;
@moabi
moabi / bulma_walker_nav_menu.php
Last active August 2, 2021 12:09
A wordpress walker for Bulma Nav component
<?php
/**
* Will add classes to create bulma menu in wordpress
* http://bulma.io/documentation/components/nav/
* Usage
* wp_nav_menu(array(
* 'theme_location' => 'primary',
* 'items_wrap' => '%3$s',
* 'container_class' => 'nav-right nav-menu',
* 'walker' => new bulma_walker_nav_menu
@zmts
zmts / tokens.md
Last active May 20, 2024 12:40
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@Yimiprod
Yimiprod / difference.js
Last active May 10, 2024 16:49
Deep diff between two object, using lodash
/**
* This code is licensed under the terms of the MIT license
*
* Deep diff between two object, using lodash
* @param {Object} object Object compared
* @param {Object} base Object to compare with
* @return {Object} Return a new object who represent the diff
*/
function difference(object, base) {
function changes(object, base) {
@JFK
JFK / gist:4591707
Last active September 16, 2019 21:10
Ngnix + Nginx-GridFS-Replicaset(mongodb) + nginx-image-filter +nginx-proxy-cache Sample Configuration
user www-data;
#worker_processes 4;
#worker_priority 0;
#worker_cpu_affinity 0001 0010 0100 1000;
#worker_rlimit_nofile 163840;
#worker_processes 8;
#worker_priority 0;
#worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;
@K-Phoen
K-Phoen / config.yml
Created December 18, 2012 11:22
Storing Symfony2 sessions in memcached
imports:
# ....
- { resource: services/session.yml }
framework:
# ....
session:
handler_id: session.handler.memcached
@netmeansnet
netmeansnet / Entity
Created April 14, 2012 12:17
Symfony2 OverAge Validator
<?php
namespace Acme\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Nmn\Validator\Constraints as NmnAssert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
@eligrey
eligrey / object-watch.js
Created April 30, 2010 01:38
object.watch polyfill in ES5
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/