Skip to content

Instantly share code, notes, and snippets.

@fullpipe
fullpipe / gist:6069995
Created July 24, 2013 12:15
Jquery plugin wraper
;(function ( $, window, document, undefined ) {
// Create the defaults once
var pluginName = 'defaultPluginName',
defaults = {
propertyName: "value"
};
// The actual plugin constructor
function Plugin( element, options ) {
this.element = element;
/*
In security.yml I declared a parameter (for the life of me, I can't remember if this was important):
# security.yml
parameters:
security.acl.permission.map.class: Acme\DemoBundle\Security\Acl\Permission\PermissionMap
In services.yml I redeclare the acl collection cache service:
@fullpipe
fullpipe / mb_replace.php
Created December 6, 2013 18:30
php: mb_replace
function mb_replace($search, $replace, $subject, &$count=0) {
if (!is_array($search) && is_array($replace)) {
return false;
}
if (is_array($subject)) {
// call mb_replace for each single string in $subject
foreach ($subject as &$string) {
$string = &mb_replace($search, $replace, $string, $c);
$count += $c;
}
@fullpipe
fullpipe / scrollToMe.js
Created June 27, 2014 06:49
Scroll page to specific element.
$(document).ready(function() {
"use strict";
$.fn.scrollToMe = function(force) {
var
force = force || false,
elemOffset = $(this).offset(),
$bodyElem = $.browser.safari ? $("body") : $("html"),
topScroll = +$bodyElem.scrollTop(),
windowHeight = $(window).height()
@fullpipe
fullpipe / gist:c438bc626a21df41608b
Last active August 29, 2015 14:05
justify menu
<ul>
<li><a href="#">Menu item 1</a></li>
<li><a href="#">Menu item 2</a></li>
<li><a href="#">Menu item 3</a></li>
<li><a href="#">Menu item 4</a></li>
<li><a href="#">Menu item 5</a></li>
</ul>
@fullpipe
fullpipe / gist:0a2e133926bc353d7ad0
Created January 23, 2015 14:26
sync Sublime text 3 settings and packages throw Dropbox

If your Dropbox folder is not in the default location, you'll need to change ~/Dropbox to your location.

  • Close Sublime Text
  • Open Terminal

First Machine (Origin)

On your first machine, use the following instructions.

cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/
mkdir ~/Dropbox/Sublime
@fullpipe
fullpipe / usb serial driver for arduino
Last active October 3, 2020 23:01
usb serial driver for arduino clone on mac osx yosemite
1. download and install http://www.wch.cn/download/CH341SER_MAC_ZIP.html
2. run `sudo nvram boot-args="kext-dev-mode=1"`
3. Reboot
4. Enjoy you port `/dev/cu.wchusbserial**`
@fullpipe
fullpipe / sonata_admin_child_admin.md
Last active November 8, 2018 13:55
sonata admin child admin

from smlr

First, create your AAdmin, ABAdmin and BAdmin Classes like you would, if those Classes wouldn't share any relation. After this, add to your sonata.admin.A service a Child sonata.admin.AB (Admin.yml or Admin.xml).

Than you can use the configureSideMenu() method in AAdmin to create a sidemenu and generate a link to ABAdmin.

It's important to add $parentAssociationMapping to your ABAdmin Class and adding some if-statements to improve the usability, if list and form is in a A-context.

If you know the mechanism, it's quite easy. Hope my example works for you..

.flip-container {
$width: 320px;
$height: 480px;
$duration: 0.6s;
@include perspective($width + $height);
@include transform-style(preserve-3d);
width: $width;
height: $height;
@fullpipe
fullpipe / domain.conf
Last active October 6, 2015 09:11
nginx+pagespeed
server {
pagespeed off;
# Needs to exist and be writable by nginx. Use tmpfs for best performance.
log_not_found off;
pagespeed FileCachePath /var/ngx_pagespeed_cache;
pagespeed EnableFilters rewrite_images,collapse_whitespace,dedup_inlined_images,defer_javascript,elide_attributes,extend_cache,rewrite_javascript,move_css_to_head,rewrite_css,sprite_images,fallback_rewrite_css_urls,combine_css,lazyload_images,remove_comments;
#pagespeed RewriteLevel OptimizeForBandwidth;
pagespeed Statistics on;