Skip to content

Instantly share code, notes, and snippets.

@swapnilshrikhande
swapnilshrikhande / showInstallNewOnly.js
Created February 24, 2015 11:07
jQuery script for showing entries without a version from a SFDC package Table
/*
    jQuery script for showing entries without a version from a SFDC package Table
    Use with: https://chrome.google.com/webstore/detail/jquery-shell/cbbihnlpjnikhccblfddkbddcggagbci
*/
$('table[id$="packageComponentTable"] td:nth-child(7)').each(function() {
    if ($(this).is(':empty') == false) {
    $(this).closest('tr').remove();
  }
});
@swapnilshrikhande
swapnilshrikhande / day-by-day-disable-dates
Created June 25, 2015 12:09
jQuery Datepicker Day by Day disable dates
$('#nationalPicker').datepick({
onDate: nationalDays, showTrigger: '#calImg'});
var natDays = [[1, 26, 'au', 'Australia'], [2, 6, 'nz', 'New Zealand'],
[3, 17, 'ie', 'Ireland'], [4, 27, 'za', 'South Africa'],
[5, 25, 'ar', 'Argentina'], [6, 6, 'se', 'Sweden'],
[7, 4, 'us', 'United States'], [8, 17, 'id', 'Indonesia'],
[9, 7, 'br', 'Brazil'], [10, 1, 'cn', 'China'],
[11, 22, 'lb', 'Lebanon'], [12, 12, 'ke', 'Kenya']];
/**
* Luhn algorithm in JavaScript: validate credit card number supplied as string of numbers
* @author ShirtlessKirk. Copyright (c) 2012.
* @license WTFPL (http://www.wtfpl.net/txt/copying)
*/
var luhnChk = (function (arr) {
return function (ccNum) {
var
len = ccNum.length,
bit = 1,
@swapnilshrikhande
swapnilshrikhande / find_all_attributes.js
Last active October 13, 2015 08:24
Find all attributes of an dom element and cloning it
//finding all attributes of an element.
$(this).each(function() {
$.each(this.attributes, function() {
// this.attributes is not a plain object, but an array
// of attribute nodes, which contain both the name and value
if(this.specified) {
console.log(this.name, this.value);
}
});
});
@swapnilshrikhande
swapnilshrikhande / pricebook_entry_testmethod.java
Last active January 25, 2016 10:07
Creating Pricebook entry inside test method
Product2 product = new Product2();
product.Name = 'Product Example';
product.RecordTypeId = '<Product record type id>';
product.Family = null;
product.IsActive = true;
insert product;
PricebookEntry pricebookEntry = new PricebookEntry();
pricebookEntry.Pricebook2Id = Test.getStandardPriceBookId();
pricebookEntry.Product2Id = product.Id;
@swapnilshrikhande
swapnilshrikhande / list_old_kernerls.sh
Created March 20, 2016 11:05
Ubuntu list old kernerls
dpkg --list | grep linux-image | cut -d " " -f 3
/* ------------------------------------------
* CSS3 GITHUB BUTTONS (Nicolas Gallagher)
* Licensed under Unlicense
* http://github.com/necolas/css3-github-buttons
* --------------------------------------- */
/* =============================================================================
Base Button
========================================================================== */
@swapnilshrikhande
swapnilshrikhande / getLabelValueInApex.cls
Created April 1, 2016 10:34
Apex : Get Label Value By API Name
//This method return the String value for the Label Name
public String getLabelString(String labelName ){
Component.Apex.OutputText output = new Component.Apex.OutputText();
output.expressions.value = '{!$Label.' + labelName + '}';
return String.valueOf(output.value);
}
@swapnilshrikhande
swapnilshrikhande / sortingRowsWithInput.js
Created April 7, 2016 12:10
Sort a table based on column containing inputs and input values.
var people, asc1 = 1,
asc2 = 1,
asc3 = 1;
function sort_table(col, asc) {
actualData = document.getElementById("actualData");
var rows = actualData.rows,
rlen = rows.length,
arr = new Array(),
arrshow= new Array(),
@swapnilshrikhande
swapnilshrikhande / GroupSortableTable_FixedHeader_ScrollSpy_Bootstrap.html
Created April 20, 2016 09:42
GroupSortableTable FixedHeader ScrollSpy Bootstrap Snippet
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="https://rawgit.com/wenzhixin/bootstrap-table/master/src/bootstrap-table.css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>