Skip to content

Instantly share code, notes, and snippets.

@vovayatsyuk
vovayatsyuk / magento2-development.md
Last active November 11, 2019 19:04
Magento2 development snippets

Search Patterns

Css
app/design/frontend/Magento,lib/web/css,*.less,-**/docs/*

Clear preprocessed and generated scripts and styles

@igorcosta
igorcosta / cpf_cnpj_validator
Created June 26, 2014 19:13
Regex para validar CPF e CNPJ
Para CPF
/^\d{3}\.\d{3}\.\d{3}\-\d{2}$/
Para CNPJ
/^\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}$/
Para ambos ao mesmo tempo
@tvanantwerp
tvanantwerp / custom-social-media-buttons.md
Last active September 20, 2022 10:54
Custom Social Media Sharing Buttons

Custom Sharing Buttons for Social Media

These files contain a basic template for creating customized social media share buttons on a web page. The CSS styles are arbitrary, and easily changes. The HTML and JavaScript works as follows.

HTML Structure

The buttons are simply a elements with no href value. Font Awesome is used to add icons. The IDs are used by the JavaScript to modify these a elements.

JavaScript Structure

This file uses jQuery.

Three functions are defined to find share counts for Facebook, Twitter and LinkedIn. Google+ is currently excluded.

The web page address is grabbed by window.location.href and encoded. The page title is pulled from whatever HTML element has id="title". The share count functions are called, and the results appended to the inner text of the share buttons. The the href of each button is changed to the appropriate URL for sharing the webpage.

@niksumeiko
niksumeiko / git.migrate
Last active June 26, 2024 21:41
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@betweenbrain
betweenbrain / gist:2284129
Created April 2, 2012 14:56
Git command to export only changed files between two commits
git archive --output=file.zip HEAD $(git diff --name-only SHA1 SHA2)
@davestewart
davestewart / gist:1041464
Created June 22, 2011 22:52
Multiple JSDoc parameters example
/**
* Set the Frame of the Context object
* @param value {Context} A Context object with a valid frame property
* @param value {Boolean} Pass true to grab the current frame
* @param value {String} The name of the frame
* @param value {Number} The 0-based index of the frame
* @param value {Frame} A Frame
* @param [allLayers] {Boolean} Optionally search all layers, when specifying a named frame
* @returns
*/