Skip to content

Instantly share code, notes, and snippets.

@goyuix
goyuix / mime.json
Created September 10, 2013 03:11
Mime map in JSON format
[{"ext":".323","mime":"text/h323"},{"ext":".3g2","mime":"video/3gpp2"},{"ext":".3gp2","mime":"video/3gpp2"},{"ext":".3gp","mime":"video/3gpp"},{"ext":".3gpp","mime":"video/3gpp"},{"ext":".aac","mime":"audio/aac"},{"ext":".aaf","mime":"application/octet-stream"},{"ext":".aca","mime":"application/octet-stream"},{"ext":".accdb","mime":"application/msaccess"},{"ext":".accde","mime":"application/msaccess"},{"ext":".accdt","mime":"application/msaccess"},{"ext":".acx","mime":"application/internet-property-stream"},{"ext":".adt","mime":"audio/vnd.dlna.adts"},{"ext":".adts","mime":"audio/vnd.dlna.adts"},{"ext":".afm","mime":"application/octet-stream"},{"ext":".ai","mime":"application/postscript"},{"ext":".aif","mime":"audio/x-aiff"},{"ext":".aifc","mime":"audio/aiff"},{"ext":".aiff","mime":"audio/aiff"},{"ext":".application","mime":"application/x-ms-application"},{"ext":".art","mime":"image/x-jg"},{"ext":".asd","mime":"application/octet-stream"},{"ext":".asf","mime":"video/x-ms-asf"},{"ext":".asi","mime":"application/
javascript:(function ($) {
var pages = 20;
function getPosts(page) {
$.get("page/" + page + "/?rand=" + (new Date()).getTime(), function (d) {
$("#post-wrapper").append($(d).find("div.post-wrapper-hentry"));
if (page + 1 < pages) { getPosts(page + 1); }
});
} if (window.jQuery) { getPosts(2); } else {
var s = document.createElement('script');
s.type = "text/javascript";
@goyuix
goyuix / JHRL Properties JSON
Created August 11, 2013 19:10
Property names mapped to id parameter (index in array) for this URL http://jhrl.com/properties.html?controller=Listings&action=view&id= Maybe add in a function to pull in more rich information (bedrooms, description, photos, etc.) a have an array of objects in the future.
["Aspens Hollyhock 2012- 1BD/1BA Condominium","Teton Manor 4 Bedroom / 3 Bath","","","","","","","","","Aspen House 4BD/2BA","Bailey House 3BD/3BA","Barry House 4BD/3BA","Best House 5BD/3.5BA","Bowie House 3.5BD/3.5BA","Cody House 3.5 Bedroom / 3 Bath","Cody Peak Lodge 4BD/4.5BA","Delphi House 5BD/3.5BA","Granite Ridge Cabin 7590 2BD/2.5 BA","","Granite Ridge Lodge 20 5BD/4.5BA","The Heron House 4BD Plus 2 Lofts/6.5BA","Iron H Lodge at Granite Ridge 6BD/6.5BA","Johnson House 3BD/3BA","Macker's Cabin 5.5BD/5BA","","McBean House 4BD/3.5BA","","","","","Phoenix House 4BD/4BA","The Aspens 1 Bedroom Condominium","The Aspens 2 Bedroom Condominium","","","","Luxury Shooting Star 4 Bedroom Cabin","Steele House 4BD/3.5 BA","Teton Retreat 4 BD/4BA","","","","Tram Tower 3505-4BD/5BA Teton Village Townhome","Tuckaway House 5 BD/3.5BA","Teton Village 1 Bedroom ","Teton Village 2 Bedroom/ 1 bath Condominium","Teton Village 2 Bedroom/ 2 bath Condominium","Teton Village 2 Bedroom Plus Loft Condominium","","","","Teton Villag
@goyuix
goyuix / Download-File.ps1
Created June 28, 2013 21:24
PowerShell cmdlet to facilitate downloading files
function Download-File {
param(
[Parameter(Mandatory=$true, Position = 0)][string]$Uri,
[Parameter(Mandatory=$false, Position = 1)][string]$SaveAs
)
$loc = [System.IO.Path]::GetFullPath([System.IO.Path]::GetFileName($Uri))
if ($SaveAs) { $loc = [System.IO.Path]::GetFullPath($SaveAs) }
$wc = New-Object System.Net.WebClient
$wc.UseDefaultCredentials = $true
# I just need to add in proper proxy support
@goyuix
goyuix / gist:5351475
Last active December 16, 2015 00:59
Sample script to page in multiple blog pages for easier scrolling
// add in jQuery if it is not loaded
if (!window.jQuery) {
var script = document.createElement('script');
script.type="text/javascript";
script.src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
document.getElementsByTagName("head")[0].appendChild(script);
}
function getPosts(page) {
if (window.jQuery == undefined) { return setTimeout(function(){getPosts(page);},100); }
@goyuix
goyuix / AddManagedMetadataMapping.ps1
Created December 4, 2012 00:39
script 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
# Author: Greg McMurray
# History:
# 2012-12-3: Initial version
# a few convenience variables
$YesNo = [Microsoft.SharePoint.Search.Administration.ManagedDataType]::YesNo
$searchApp = Get-SPEnterpriseSearchServiceApplication
# get reference to "Active" property - internally known as ows_RoutingEnabled
@goyuix
goyuix / ResizeWPF.linq
Created November 20, 2012 01:23
WPF Image Resize code for LINQPad
<Query Kind="Statements">
<Reference>&lt;RuntimeDirectory&gt;\System.Xaml.dll</Reference>
<Reference>&lt;RuntimeDirectory&gt;\WPF\WindowsBase.dll</Reference>
<Reference>&lt;RuntimeDirectory&gt;\WPF\PresentationCore.dll</Reference>
<Namespace>System.Windows.Media</Namespace>
<Namespace>System.Windows.Media.Imaging</Namespace>
</Query>
var ThumbnailSize = 800;
var source = @"C:\Users\Heather\Pictures\Canon SX230";
@goyuix
goyuix / P4-RobustGrep
Created September 19, 2012 16:56
Getting around the "grep revision limit exceeded" in Perforce
# p4 dirs //depot/* returns all the top level folders
#
# % means ForEach-Object, e.g. each top level folder from p4 dirs
#
# -s is to quiet the line length > 4096 noise
# -i is to make it case insensitive
# -e is followed by the search expression
# and the last argument is the path to search
p4 dirs //depot/* | % { p4 grep -s -i -e "search expression" "$_/..." }
@goyuix
goyuix / WebMatrixExtension.FileTableService.Hook.cs
Created July 12, 2012 02:42
WebMatrix Import IFileTableService for hooking save events
[Import(typeof(IFileTableService))]
private IFileTableService FileTableService { get; set; }
@goyuix
goyuix / Merge-Data.ps1
Created July 6, 2012 03:17
Add file size to CSV in PowerShell - merge in size/length from filesystem
gc J:\private\wbfs\DecoderRing.txt |
ConvertFrom-Csv -Delimiter "`t" |
% {
Add-Member -InputObject $_ -MemberType NoteProperty -Name Length -Value (dir $_.ID).Length -Passthru
} | Export-Csv J:\decoder.csv