Skip to content

Instantly share code, notes, and snippets.

View hjJunior's full-sized avatar

Helio S. Junior hjJunior

View GitHub Profile
@hjJunior
hjJunior / how-to-git-patch-diff.md
Created July 1, 2022 22:28 — forked from jplindgren/how-to-git-patch-diff.md
How to generate and apply patches with git? — First published in fullweb.io issue #33

How to generate and apply patches with git?

It sometimes happen you need change code on a machine from which you cannot push to the repo. You’re ready to copy/paste what diff outputs to your local working copy.

You think there must be a better way to proceed and you’re right. It’s a simple 2 steps process:

1. Generate the patch:

git diff > some-changes.patch
@hjJunior
hjJunior / inline-svg-function.scss
Created June 17, 2019 15:18 — forked from JacobDB/inline-svg-function.scss
Inline SVG function [SASS]
// Replace letters
@function str-replace($string, $search, $replace: '') {
$index: str-index($string, $search);
@if $index {
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
}
@return $string;
}
@hjJunior
hjJunior / mysql_backup_cron.sh
Created April 11, 2018 21:24 — forked from jabranr/mysql_backup_cron.sh
Automatic MySQL dump and backup to Git repo cron job
#!/bin/sh
#
# @author: Jabran Rafique <[email protected]>
# @link: http://jabran.me/articles/automatic-database-backup-using-git-hosting/
# Set variables
FULLDATE = $(date +"%Y-%d-%m %H:%M")
NOW = $(date +"%Y-%m-%d-%H-%M")
MYSQL_DUMP = `which mysqldump`
GIT = `which git`
@hjJunior
hjJunior / two_line_item_layout.xml
Created January 2, 2017 22:59 — forked from renanferrari/two_line_item_layout.xml
Android Material Design List Item Layouts (based on http://stackoverflow.com/a/27661786/518179)
<!-- Clickable and selectableItemBackground are optional -->
<RelativeLayout
android:id="@+id/two_line_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:clickable="true"
android:minHeight="72dp"
android:paddingEnd="?listPreferredItemPaddingRight"
android:paddingLeft="?listPreferredItemPaddingLeft"
@hjJunior
hjJunior / gist:4fe04e6af18470095265a8e39a50dbe6
Created November 18, 2016 22:46 — forked from prime31/gist:5675017
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array