Skip to content

Instantly share code, notes, and snippets.

Example: You have a branch refactor that is quite different from master. You can't merge all of the commits, or even every hunk in any single commit or master will break, but you have made a lot of improvements there that you would like to bring over to master.

Note: This will not preserve the original change authors. Only use if necessary, or if you don't mind losing that information, or if you are only merging your own work.

On master:

> git co -b temp
@mmilidoni
mmilidoni / joomla_banner_on_article.js
Last active April 11, 2016 12:49
joomla banner on Article
jQuery(document).ready(function() {
var isMobile = false; //initiate as false
// device detection
if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)
|| /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230
<?php
/**
* This class permits a Telegram bot to send messages to chat groups.
*
* Usage is simple:
* $obj = new TelegramMessage("bot_token");
* $obj->send("message", "chat_id");
*
* Useful stuff:
#!/usr/bin/python
# https://github.com/phonegap/phonegap/wiki/App-Splash-Screen-Sizes
splashesAndroid = [
{"resize": 320, "crop": "200x320", "fileout": "drawable-port-ldpi-screen"},
{"resize": 320, "crop": "320x200", "fileout": "drawable-land-ldpi-screen"},
{"resize": 480, "crop": "320x480", "fileout": "drawable-port-mdpi-screen"},
{"resize": 480, "crop": "480x320", "fileout": "drawable-land-mdpi-screen"},
#!/usr/bin/python
# https://github.com/phonegap/phonegap/wiki/App-Icon-Sizes
iconsAndroid = [
{"resize": 192, "fileout": "drawable-xxxhdpi-icon"},
{"resize": 144, "fileout": "drawable-xxhdpi-icon"},
{"resize": 96, "fileout": "drawable-xhdpi-icon"},
{"resize": 72, "fileout": "drawable-hdpi-icon"},
{"resize": 48, "fileout": "drawable-mdpi-icon"},
@mmilidoni
mmilidoni / sf_pkg_builder_from_git.sh
Created September 5, 2018 13:55
Salesforce package.xml builder from GIT repository
#/usr/bin/env bash
# -bname build name
# -wspace build workspace dir
# -lcommit builds last commit
#read command line args
while getopts b:w:l: option
do
case "${option}"
in
@mmilidoni
mmilidoni / csvsplit.ps1
Last active October 5, 2021 13:14
Powershell script to split CSV files
param ($source, $lines)
if ($source -eq $null) {
$source = read-host -Prompt "Please enter a filename"
}
if ($lines -eq $null) {
$lines = read-host -Prompt "Please enter the number of lines for each chunk"
}
# variable used to store the path of the source CSV file
$sourceCSV = $source;
@mmilidoni
mmilidoni / generate.py
Created January 19, 2023 15:22
SFDC - Generate package from metadata list
'''
select id, copado__User_Story__r.Name, copado__User_Story__r.copado__User_Story_Title__c, copado__Metadata_API_Name__c, copado__User_Story__r.copado__Status__c
from copado__User_Story_Metadata__c
where copado__User_Story__r.copado__Project__c = 'aQ42K0000008ONySAM'
'''
f = open("metadata.txt", "r")
packageFolder = "deltaPackages"