Skip to content

Instantly share code, notes, and snippets.

/* ------------------------------------------
* CSS3 GITHUB BUTTONS (Nicolas Gallagher)
* Licensed under Unlicense
* http://github.com/necolas/css3-github-buttons
* --------------------------------------- */
/* =============================================================================
Base Button
========================================================================== */
@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
@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 / 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);
}
});
});
/**
* 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 / 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']];
@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();
  }
});
//get all objects
Map<String, Schema.SObjectType> objects = Schema.getGlobalDescribe();
Schema.DescribeSObjectResult objInfo = null;
for (Schema.SObjectType obj : objects.values()) {
objInfo = obj.getDescribe();
System.debug(objInfo.getName() + ' [' + objInfo.getLabel() + ']');
}
//get all fields for account object
@swapnilshrikhande
swapnilshrikhande / showMessage.html
Last active August 29, 2015 14:10
showMessage.js
<style>
/*Popup message boxes css*/
/*Message boxes*/
.message-box{
position: fixed;
top:2%;
left: 40%;
/*width: 40%;*/
border: 1px solid;
/*
This game is for Unix only.
It is a simple yet easily navigable Tic-Tac-Toe game for the Unix terminal. To run this file, go
to your awesome Unix terminal and (after you have downloaded this text file, of course) and
navigate to this file. Then, compile and link the program with your handy compiler which will
almost definitely be installed unless you have removed it using the command 'gcc TicTacToe.c'.
This creates an executeable. To run it, you can simply type './a.out'. If you want to have a more
memorable file and/or prevent conflicts, simply change the name with the 'mv' tool
('mv a.out TicTacToe') or use the '-o' ("output file") when compiling