Skip to content

Instantly share code, notes, and snippets.

@mmilidoni
mmilidoni / csvsplit.ps1
Last active Oct 5, 2021
Powershell script to split CSV files
View csvsplit.ps1
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 / sf_pkg_builder_from_git.sh
Created Sep 5, 2018
Salesforce package.xml builder from GIT repository
View sf_pkg_builder_from_git.sh
#/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
View phonegap-icons-generator.py
#!/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"},
View phonegap-splashscreen-generator.py
#!/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"},
View TelegramMessage.php
<?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:
@mmilidoni
mmilidoni / joomla_banner_on_article.js
Last active Apr 11, 2016
joomla banner on Article
View joomla_banner_on_article.js
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
View git-selective-merge.md

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