Skip to content

Instantly share code, notes, and snippets.

@purtuga
purtuga / css3-text-shadow-effects.markdown
Created September 15, 2018 15:55
CSS3 text-shadow effects
@purtuga
purtuga / bookmarklet-post-with-buffer.js
Created June 4, 2018 14:46
Post with Buffer by opening a new window to the buffer add page
(function(encodeURI, DOCUMENT){
var link = DOCUMENT.createElement("a");
link.href="https://buffer.com/add?text=" + encodeURI(DOCUMENT.title) + "&url=" + DOCUMENT.location;
link.setAttribute("style", "position:absolute;left=-99999px;top:-99999px;visibility:hidden");
link.setAttribute("target", "_blank");
DOCUMENT.body.appendChild(link);
link.click();
setTimeout(function(){link.parentNode.removeChild(link);}, 10);
})(encodeURIComponent, document);
@purtuga
purtuga / ie.aspx
Last active January 11, 2019 13:36
SharePoint file that forces IE into EDGE mode and load a given aspx page in an iframe. See http://wp.me/p2kCXW-95
<!DOCTYPE html>
<html>
<head>
<!--
Set the IE rendering engine to EDGE and loads a given aspx file in an iframe,
thus forcing it to be rendered using the browser's latest rendering engine.
Usage: ie.aspx?file.aspx
The default page to be loaded, when this file is accessed, can be set below (url variable).
@purtuga
purtuga / grunt.copy.onlyNew.js
Last active August 29, 2015 14:10
A grunt-copy task filter option function. Enables the copying of only changed files to the destination.
/**
* Returns a function that can be used with grunt's copy
* task 'filter' option. Checks if file being copied
* is newer than that destination file. A local file can be
* used as the "destination" timestampt - a useful method for
* when the destination file is really in a remote system
* (ex. linux server, or a WEBDav folder).
*
* @param {Array} target
* The grunt Copy configurtaion task that this instance
@purtuga
purtuga / grunt.copy.includeFile.js
Last active June 14, 2019 13:11
A Grunt Copy process function to embed content of files into other files.
/**
* includeFile() - embeds a file content within another. Meant to be
* used from the copy task as a 'processContent' function. The following
* tokens can be used in files: <br>
*
* - BUILD_INCLUDE('file')
* - /* BUILD_INCLUDE('file') *\x47
* - &lt;!-- BUILD_INCLUDE("file") --&gt;
*
* In addition, options can be added to the token above that further
@purtuga
purtuga / spservices.forum.444799.test.aspx
Created October 25, 2014 15:28
SPServices test file - forum post 444799
<%@ Page language="C#" MasterPageFile="~masterurl/default.master"
Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %>
<%@ Register
Tagprefix="SharePoint"
Namespace="Microsoft.SharePoint.WebControls"
Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register
Tagprefix="Utilities"
Namespace="Microsoft.SharePoint.Utilities"
Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<And>
<Neq>
<FieldRef Name='ID'/>
<Value Type='Counter'>0</Value>
</Neq>
</And>
<Or>
... Real filters here filters you want here ...
</Or>
</And>
@purtuga
purtuga / jQuery.SPGetListItemInfoByUrl.js
Last active August 29, 2015 13:56
Sharepoint WebServices utlity to retrieve information about a List (or Document Library) item based on its URL.
/**
* Given a URL to an item, this method will retrieve information about
* that URL, including the List UID and the ID of the item within the
* list.
*
* @param {Object|String} options
* An object with the options below or a string with the URL.
*
* @param {String} options.url
* @param {String} [options.webURL=(current site)]
@purtuga
purtuga / jQuery.doWhen.js
Created January 4, 2014 16:49
A jQuery utility leveraging the Deferred Class to execute a code block in the future after a given condition is meet. See blog post for more: http://wp.me/p2kCXW-35
/*! Copyright (c) 2014 - Paul Tavares - purtuga - @paul_tavares - MIT License */
;(function($){
/**
* Delays the execution of a function until an expression returns true.
* The expression is checked every 100 milliseconds for as many tries
* as defined in in the attempts option
*
* @param {Object} options
* @param {Function} options.when
@purtuga
purtuga / jquery.SPWidgets.js
Last active December 27, 2015 11:59
Proposed fix to Issue #9 of SPWidgets
/**
* @fileOverview jquery.SPWidgets.js
* jQuery plugin offering multiple Sharepoint widgets that can be used
* for creating customized User Interfaces (UI).
*
* @version 20131106052852
* @author Paul Tavares, www.purtuga.com, paultavares.wordpress.com
* @see http://purtuga.github.com/SPWidgets/
*
* @requires jQuery.js {@link http://jquery.com}