Skip to content

Instantly share code, notes, and snippets.

@Salvodif
Salvodif / AzureAssetsConf
Last active August 29, 2015 14:01
Upload Assets to Azure's Blob Storage
<?xml version="1.0" encoding="utf-8" ?>
<AzureConf>
<Blob>
<CssContainer Name="styles">
<FileFormat Ext="css" ContentType="text/css" />
</CssContainer>
<JsContainer Name="scripts">
<FileFormat Ext="js" ContentType="application/javascript" />
</JsContainer>
<ImgContainer Name="images">
@Salvodif
Salvodif / gist:a308a683f18155770483
Created June 11, 2014 15:42
How to get and save a file from a list to another list in another site by REST API
function getParam ( name ) {
if ( name = ( new RegExp ( '[?&]' + encodeURIComponent ( name ) + '=([^&]*)' ) ).exec ( location.search ) )
return decodeURIComponent ( name [ 1 ] );
return "";
}
function copySelectedProposal ( selectedProposal, dstParam, succeededCallback, failedCallback ) {
@Salvodif
Salvodif / Get raw data from file or sharepoint then create a new file on sp library
Last active August 29, 2015 14:02
Get raw data from file or sharepoint then create a new file on sp library
function succeeded ( filename ) {
var statusId = SP.UI.Status.addStatus ( filename, "The file has been copied.", true );
SP.UI.Status.setStatusPriColor ( statusId, 'green' );
setTimeout ( function ( ) { SP.UI.Status.removeStatus ( statusId ); }, 4000 );
}
function failed ( filename ) {
var statusId = SP.UI.Status.addStatus ( filename, "The file hasn't been copied.", true );
SP.UI.Status.setStatusPriColor ( statusId, 'red' );
setTimeout ( function ( ) { SP.UI.Status.removeStatus ( statusId ); }, 4000 );
@Salvodif
Salvodif / gist:c2c70b4189499c1c3230
Last active August 29, 2015 14:03
Singleton with Deffered to use a cookie or get the info from an endpoint
ClientInfo = ( function ( ) {
// Instance stores a reference to the Singleton
var instance;
var obj = { };
function init ( currentUserRegion ) {
var publicMethods = {
getRegionalCurrency : function ( ) {
@Salvodif
Salvodif / README.txt
Last active August 29, 2015 14:03
Yammer API Example
To get the APP-ID-CODE you have to create a new Yammer APP likes you can see in this pic: https://onedrive.live.com/redir?resid=326B1FC9A1CE351F!15015&authkey=!AMmmiBkza5_idPM&v=3&ithint=photo%2c.png
Also is IMPORTANT allows javascript calls from the source origin.
To do this you have to specify the source origin on the app info: https://onedrive.live.com/redir?resid=326B1FC9A1CE351F!15016&authkey=!AJ62DteVIedu_q0&v=3&ithint=photo%2c.png
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/MsBuild/2003">
<UsingTask TaskName="CssCompressorTask" AssemblyFile="..\..\..\..\..\Reference Assemblies\Yahoo.Yui.Compressor.Build.MsBuild.dll" />
<UsingTask TaskName="JavaScriptCompressorTask" AssemblyFile="..\..\..\..\..\Reference Assemblies\Yahoo.Yui.Compressor.Build.MsBuild.dll" />
<PropertyGroup>
<CssMinOutputFile>..\Assets\Styles\Stylesheet1.min.css</CssMinOutputFile>
<JavaScriptMinOutputFile>..\Assets\Scripts\Javascript1.min.js</JavaScriptMinOutputFile>
</PropertyGroup>
param([string]$ProjectDir)
# for some reason we have a " to remove at the end of string
$ProjectDir = $ProjectDir.Substring(0,$ProjectDir.Length-1)
$assetsDir = [string]::Format('{0}\{1}', $ProjectDir, 'Assets')
$myCss = Get-ChildItem "$assetsDir\Styles" -Filter "*.css" | % -process { $_.FullName }
$myJs = Get-ChildItem "$assetsDir\Scripts" -Filter "*.js" | % -process { $_.FullName }
<?xml version="1.0" encoding="utf-8" ?>
<AzureConf>
<Blob>
<Container FileExt="css" Name="css" />
<Container FileExt="js" Name="scripts" />
</Blob>
<AzureAccountInfo>
<Name>your blob account name</Name>
<Key>your blob account key</Key>
</AzureAccountInfo>
"$(MSBuildBinPath)\msbuild.exe" "$(ProjectDir)yui\MSBuild.xml"
powershell.exe -Command "& {Set-ExecutionPolicy Unrestricted}"
powershell.exe -NoLogo -NonInteractive -File "$(ProjectDir)UploadBundleOnAzure.ps1" -ProjectDir "$(ProjectDir)"
var value = filter.split ( ':' );
var messageHtml = value [ 1 ] + '<span style="float: right" id="close_button_span"></span>';
Clarks.CC.Status.DisplayNotifyMessage ( "Filtered by: ", messageHtml, Clarks.CC.Status.Priority.Information );
var close_button = document.createElement ( 'a' );
var linkText = document.createTextNode ( "clear" );
close_button.appendChild ( linkText );
close_button.name = 'status_close_button';