Skip to content

Instantly share code, notes, and snippets.

@chonz0
chonz0 / Drag&Drop position for CSS animations
Created March 20, 2015 12:03
Get new left and top attributes by dragging an element
$('.animatable_elements').draggable({
start: function( event, ui ) {
//console.log( event );
//console.log( ui );
},
stop: function( event, ui ) {
//console.log(ui);
console.log('New Position Left: ' + Math.round(ui.position.left));
console.log('New Position Top: ' + Math.round(ui.position.top));
}
@chonz0
chonz0 / youtube-vimeo-url-parser.js
Last active August 29, 2015 14:25 — forked from yangshun/youtube-vimeo-url-parser.js
YouTube Vimeo URL Parser
function parseVideo (url) {
// - Supported YouTube URL formats:
// - http://www.youtube.com/watch?v=My2FRPA3Gf8
// - http://youtu.be/My2FRPA3Gf8
// - https://youtube.googleapis.com/v/My2FRPA3Gf8
// - Supported Vimeo URL formats:
// - http://vimeo.com/25451551
// - http://player.vimeo.com/video/25451551
// - Also supports relative URLs:
// - //player.vimeo.com/video/25451551
@chonz0
chonz0 / gist:502ca9fe51f9b89139d1ab67ea7a64a8
Last active April 26, 2016 23:30
WordPress gallery filter to modify the HTML output of the default gallery shortcode and style
// Custom filter function to modify default gallery shortcode output
// original source: http://robido.com/wordpress/wordpress-gallery-filter-to-modify-the-html-output-of-the-default-gallery-shortcode-and-style/
function my_post_gallery( $output, $attr ) {
// Initialize
global $post, $wp_locale;
// Gallery instance counter
static $instance = 0;
$instance++;
@chonz0
chonz0 / ionic-action-sheet-android.css
Last active July 27, 2018 08:07
Ionic: nicer styles for action sheet in Android
/*
* Credits to https://forum.ionicframework.com/t/actionsheets-android-ugly-styling-need-help/18462/12
*/
.platform-android .action-sheet-backdrop.active {
background-color: rgba(0, 0, 0, 0.1);
}
.platform-android .action-sheet {
align-content: center;
margin: auto;
max-width: 96vw;
@chonz0
chonz0 / emoji-commits.md
Last active December 28, 2016 12:25
Emoji commits
Emoji Snippet Context
🎉 :tada: initial commit
:sparkles: new feature
:heavy_plus_sign: add feature
:heavy_minus_sign: remove feature
📦 :package: modify package dependencies
🌐 :globe_with_meridians: internationalization / translations
🔧 :wrench: tooling
🎨 :art: when improving the format/structure of the code
[
{
"translations": {
"br": "Afeganistão",
"pt": "Afeganistão",
"nl": "Afghanistan",
"hr": "Afganistan",
"fa": "افغانستان",
"de": "Afghanistan",
"es": "Afganistán",
@chonz0
chonz0 / create_swap.sh
Last active June 7, 2018 14:56
Script for create swap partition
# How-to:
# curl -L https://gist.githubusercontent.com/chonz0/88c383360a4d129d5f94a36fd7be9a33/raw/26d71f46f4491fd9b5354a4db24f21007bbdc198/create_swap.sh | sh
#
# Inspired on digital ocean article https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04
# Source: https://github.com/feliperuhland/ubuntu-swap
#!/bin/sh
set -e
@chonz0
chonz0 / terminal-git-branch-name.md
Created June 9, 2018 05:40 — forked from joseluisq/terminal-git-branch-name.md
Add Git Branch Name to Terminal Prompt (Mac)

Add Git Branch Name to Terminal Prompt (Mac)

image

Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

# Git branch in prompt.

parse_git_branch() {
# Customise this file, documentation can be found here:
# https://github.com/fastlane/fastlane/tree/master/fastlane/docs
# All available actions: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Actions.md
# can also be listed using the `fastlane actions` command
# Change the syntax highlighting to Ruby
# All lines starting with a # are ignored when running `fastlane`
# If you want to automatically update fastlane if a new version is available:
# update_fastlane