Skip to content

Instantly share code, notes, and snippets.

@goyuix
goyuix / currentUserTimeZoneBias.js
Created March 17, 2016 20:58
Getting Time Zone For Current Dynamics CRM User
(function($){
var serverUrl = Xrm.Page.context.getServerUrl();
var orgDataService = serverUrl + "/XRMServices/2011/OrganizationData.svc";
var systemUserId = Xrm.Page.context.getUserId();
$.getJSON(orgDataService + "/UserSettingsSet(guid'" + systemUserId + "')").then(function(data){
// do something with data.d.TimeZoneBias
})
})(jQuery);
jQuery.ajax({
url: "/_api/web/webs?$expand=Lists",
headers: { accept: "application/json;odata=verbose"}
}).done(function(json){
var i=0, j=0, html=[], web=null, list=null;
html.push('<table><tr><th>Web</th><th>Library</th><th>Description</th></tr>')
for (;i<json.d.results.length;i++){
web = json.d.results[i];
for (;j<web.Lists.results.length;j++){
list = web.Lists.results[j];
// remember to force exactly one evaluation of the IEnumerable through Map
public static class FluentDataReader
{
public delegate object MapDelegate<T>(IDataReader reader);
public static IEnumerable<T> Map<T> (this IDataReader reader, MapDelegate<T> mapper) where T : class
{
while (reader.Read())
{
@goyuix
goyuix / Bible Videos Sync Script
Created December 15, 2014 20:34
Bible Videos sync script from LDS.org
$wc = New-Object System.Net.WebClient
$xml = [xml]($wc.DownloadString("http://feeds.lds.org/the-life-of-jesus-christ-bible-videos-hd-eng"))
$xml.rss.channel.item | % {
$uri = [uri]$_.origLink
$wc.DownloadFile($uri.AbsoluteUri,"D:\Videos\"+$uri.Segments[$uri.Segments.Length-1])
}
@goyuix
goyuix / Launcher.exe.config
Created October 23, 2014 20:48
Config file to force .NET 4 runtime for 2.0, 3.0 and 3.5 executables
<?xml version="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0.30319"/>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>

Keybase proof

I hereby claim:

  • I am goyuix on github.
  • I am goyuix (https://keybase.io/goyuix) on keybase.
  • I have a public key whose fingerprint is B921 1F66 97E8 EA5F 0EE9 678A 96DC 80C1 5983 292B

To claim this, I am signing this object:

@goyuix
goyuix / Get-FrameCount
Created August 1, 2014 19:28
Loop over files in a directory and return animated .gif file name (only those with FrameCount property greater than 1)
# Add-Type -Assembly System.Drawing
dir *.gif | % {
$gif = [Drawing.Image]::FromFile($_.FullName)
$dim = new-object Drawing.Imaging.FrameDimension $gif.FrameDimensionsList[0]
if ($gif.GetFrameCount($dim) -gt 1) { $_.Name }
$gif.Dispose()
}
@goyuix
goyuix / Modify-DefaultHive.ps1
Created July 30, 2014 02:57
PowerShell to mount default NTUSER.DAT, modify it and unload it
Write-Host "Attempting to mount default registry hive"
& REG LOAD HKLM\DEFAULT C:\Users\Default\NTUSER.DAT
Push-Location 'HKLM:\DEFAULT\Software\Microsoft\Internet Explorer'
if (!(Test-Path Main)) {
Write-Warning "Adding missing default keys for IE"
New-Item Main
}
$sp = Get-ItemProperty -Path .\Main
Write-Host "Replacing $_ : $($sp.'Start Page')"
@goyuix
goyuix / AddManagedProperty.ps1
Created March 25, 2014 23:29
PowerShell script for SharePoint 2010 to create a managed property for search that maps to the Active (ows_RoutingEnabled) site column
# Description: script to create a managed property for search that maps to the Active (ows_RoutingEnabled) site column
# a few convenience variables
$YesNo = [Microsoft.SharePoint.Search.Administration.ManagedDataType]::YesNo
$searchApp = Get-SPEnterpriseSearchServiceApplication
# get reference to "Active" property - internally known as ows_RoutingEnabled
$crawledProperty = Get-SPEnterpriseSearchMetadataCrawledProperty -SearchApplication $searchApp -Name ows_RoutingEnabled
$crawledProperty.IsMappedToContents = $true
$crawledProperty.Update()
@goyuix
goyuix / web.config
Created October 2, 2013 15:36
Sample web.config for SharePoint 2010 _layouts folder for adding .NET 3.5 goodies (auto-properties, LINQ, etc.) to dynamically compiled files
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration>
<system.web>
<compilation debug="true" strict="false" explicit="true">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>