This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*** | |
| * This script will anchor a GameObject to a relative screen position. | |
| * This script is intended to be used with ViewportHandler.cs by Marcel Căşvan, available here: http://gamedev.stackexchange.com/a/89973/50623 | |
| * It is also copied in this gist below. | |
| * | |
| * Note: For performance reasons it's currently assumed that the game resolution will not change after the game starts. | |
| * You could not make this assumption by periodically calling UpdateAnchor() in the Update() function or a coroutine, but is left as an exercise to the reader. | |
| */ | |
| /* The MIT License (MIT) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function (ko, handlers, unwrap, extend) { | |
| "use strict"; | |
| extend(handlers, { | |
| href: { | |
| update: function (element, valueAccessor) { | |
| handlers.attr.update(element, function () { | |
| return { href: valueAccessor() }; | |
| }); | |
| } | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### | |
| inspired from http://www.knockmeout.net/2011/04/pausing-notifications-in-knockoutjs.html , with the following changes | |
| 1. Pause never causes trigger or computation | |
| 2. Resume only causes trigger if the computed dependencies were triggered while it was paused | |
| 3. Pause and Resume can be nested without any additional triggers or computation | |
| ### | |
| ko.pauseableComputed = (evaluatorFunction, evaluatorTarget) -> | |
| isPaused = ko.observable(false) | |
| pauseCounter = ko.observable(0) | |
| # Using this method ensures that when the counter goes from 1 to 2, the isPaused observable does not trigger again |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Add-Path() { | |
| [Cmdletbinding()] | |
| param([parameter(Mandatory=$True,ValueFromPipeline=$True,Position=0)][String[]]$AddedFolder) | |
| # Get the current search path from the environment keys in the registry. | |
| $OldPath=(Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).Path | |
| # See if a new folder has been supplied. | |
| if (!$AddedFolder) { | |
| Return 'No Folder Supplied. $ENV:PATH Unchanged' | |
| } | |
| # See if the new folder exists on the file system. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ko.bindingHandlers.multiselect = { | |
| init: function (element, valueAccessor, allBindingAccessors) { | |
| "use strict"; | |
| var options = valueAccessor(); | |
| ko.bindingHandlers.options.update( | |
| element, | |
| function() { return options.options; }, | |
| allBindingAccessors |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void Main() | |
| { | |
| var databaseInfo = GetDatabaseInfo(this); | |
| databaseInfo.Dump(); | |
| } | |
| // Define other methods and classes here | |
| public class DatabaseInfo | |
| { | |
| public Type DataContextType { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ko.bindingHandlers.scroll = { | |
| updating: true, | |
| init: function(element, valueAccessor, allBindingsAccessor) { | |
| var self = this | |
| self.updating = true; | |
| ko.utils.domNodeDisposal.addDisposeCallback(element, function() { | |
| $(window).off("scroll.ko.scrollHandler") | |
| self.updating = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // if (!window.L) { window.L = function () { console.log(arguments);} } // optional EZ quick logging for debugging | |
| /** | |
| * A modified (improved?) version of the jQuery plugin design pattern | |
| * See http://docs.jquery.com/Plugins/Authoring (near the bottom) for details. | |
| * | |
| * ADVANTAGES OF EITHER FRAMEWORK: | |
| * - Encapsulates additional plugin action methods without polluting the jQuery.fn namespace | |
| * - Ensures ability to use '$' even in compat modes | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Powershell script for adding/removing/showing entries to the hosts file. | |
| # | |
| # Known limitations: | |
| # - does not handle entries with comments afterwards ("<ip> <host> # comment") | |
| # | |
| $file = "C:\Windows\System32\drivers\etc\hosts" | |
| function add-host([string]$filename, [string]$ip, [string]$hostname) { |