This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var util = util || {}; | |
| util.getKeys = function (obj) { | |
| var r = [] | |
| for (var k in obj) { | |
| if (!obj.hasOwnProperty(k)) | |
| continue | |
| r.push(k) | |
| } | |
| return r; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var credential = ' OAuth ' + "<session id of target org >"; // native VF function | |
| var apiUrl = "https://ap1.salesforce.com/services/data/v26.0/chatter/users/me"; | |
| $.ajax({ | |
| type: "GET", | |
| // for community pages, use whole community url including path, e.g. | |
| // https://logan.blitz01.t.force.com/customers/services/proxy. | |
| url: "https://na9.salesforce.com/services/proxy", | |
| contentType: 'application/json', | |
| cache: false, | |
| success : function(response) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static List<Sobject> sort(List<Sobject> sourceList,String fieldName){ | |
| List<Sobject> sortedList = new List<Sobject>(); | |
| List<SObjectWrapper> wrapperList = new List<SObjectWrapper>(); | |
| for(Sobject object : sourceList){ | |
| SObjectWrapper wrapperObject = new SObjectWrapper(object,fieldName); | |
| wrapperList.add(wrapperObject); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function closureParentFunction(){ | |
| var localVar = 0; | |
| var localFunction = function(){ | |
| console.log('localVar=',++localVar); | |
| } | |
| setInterval(localFunction,2000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var BKSPKEY = 8; | |
| handleCommandDelete = function(event,component){ | |
| var messageBox = $(component); | |
| var valueText = messageBox.val(); | |
| //get current cursor position | |
| if(event.keyCode != BKSPKEY){ | |
| return true; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function bubbleSort (sortingArray) { | |
| var goto = sortingArray.length - 1; | |
| for(var key in sortingArray) { | |
| for(var i = 0; i <= goto - 1; i++) { | |
| if(sortingArray[i] > sortingArray[i + 1]) { | |
| // Swap | |
| var temp = sortingArray[i]; | |
| sortingArray[i] = sortingArray[i +1]; | |
| sortingArray[i + 1] = temp; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| int nextprime(int number); | |
| int isprime(int value); | |
| int main(void) | |
| { | |
| // let size of each choc. be 50 grm | |
| long int chocw=50; | |
| long int expectedw=0; | |
| long int resultw=0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <style> | |
| /*Popup message boxes css*/ | |
| /*Message boxes*/ | |
| .message-box{ | |
| position: fixed; | |
| top:2%; | |
| left: 40%; | |
| /*width: 40%;*/ | |
| border: 1px solid; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //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 |