Skip to content

Instantly share code, notes, and snippets.

View IAMIronmanSam's full-sized avatar
🎯
Focusing

Tony Stark IAMIronmanSam

🎯
Focusing
View GitHub Profile
@IAMIronmanSam
IAMIronmanSam / getContenTypeInfo.cs
Created March 16, 2015 17:01
Get Content Type Info in Sharepoint
public static String getContenTypeInfo(ClientContext cnxt,String lstName,String ctName,String flag){
String ctInfo = "";
List lst = cnxt.Web.Lists.GetByTitle(lstName);
ContentTypeCollection listContentTypes = lst.ContentTypes;
cnxt.Load(listContentTypes);
cnxt.ExecuteQuery();
foreach (ContentType ct in listContentTypes)
{
if (ct.Name == ctName)
{
@IAMIronmanSam
IAMIronmanSam / moment.js
Created April 20, 2015 11:32
MomentJS Time & date formaters
$(function() {
// Now
var now = moment();
// Format string
/*
Month
-----------------------------
M: 1 2 ... 11 12
Mo: 1st 2nd ... 11th 12th
@IAMIronmanSam
IAMIronmanSam / fadeToggle.html
Created May 4, 2015 17:32
Fade Toggle animation using CSS
<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 100px;
height: 100px;
background: red;
position: relative;
-webkit-animation: mymove 10s infinite; /* Chrome, Safari, Opera */
Array.prototype.unique1 = function()
{
var n = [];
for(var i = 0; i < this.length; i++)
{
if (n.indexOf(this[i]) == -1) n.push(this[i]);
}
return n;
}
@IAMIronmanSam
IAMIronmanSam / loader.js
Created January 7, 2016 05:00
SharePoint Loader
var waitDialog = null;
ExecuteOrDelayUntilScriptLoaded(ShowWaitDialog, "sp.js");
function ShowWaitDialog() {
try {
if (waitDialog == null) {
waitDialog = SP.UI.ModalDialog.showWaitScreenWithNoClose('Processing...', 'Please wait while request is in progress...', 76, 330);
}
} catch (ex) { }
};
//When progress is done
@IAMIronmanSam
IAMIronmanSam / get&SetQueryString.js
Created January 7, 2016 07:26
Get & Set QuerString parameter
function getParameterByName(name) {
var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}
function removeParameterByName(url, parameter) {
var urlparts= url.split('?');
if (urlparts.length>=2) {
var prefix= encodeURIComponent(parameter)+'=';
var pars= urlparts[1].split(/[&;]/g);
@IAMIronmanSam
IAMIronmanSam / dialog.js
Last active January 12, 2016 08:23
SharePoint 2013 Modal Dialog
function alertDialog (_msg){
var htmlElement = document.createElement('div');
htmlElement.innerHTML = "<div class=\"confirmContainer\"><img src=\"/images/Warning.jpg\" id=\"warninglogo\" alt=\"ConfirmLogo\"><span id=\"confrimtitle\">" +
_msg + "</span><button type=\"button\" id=\"confirminfo\" >OK</button>";
var options = {
width : 450,
height : 120,
html : htmlElement,
title : "Information",
showClose : close
@IAMIronmanSam
IAMIronmanSam / isEmbed.js
Created January 11, 2016 15:46
Check a content is embeded in iframe
if (window.frameElement) {
// in frame
}
else {
// not in frame
}
@IAMIronmanSam
IAMIronmanSam / nobr.css
Created January 12, 2016 09:25
Override No Break Tag <nobr>
<nobr>Don't Break This Text</nobr>
.nobr { white-space:nowrap; }
@IAMIronmanSam
IAMIronmanSam / mediaQuery.css
Created January 21, 2016 08:04
Media query for different screen size
/* (320x480) iPhone (Original, 3G, 3GS) */
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
/* insert styles here */
}
/* (320x480) Smartphone, Portrait */
@media only screen and (device-width: 320px) and (orientation: portrait) {
/* insert styles here */
}