Skip to content

Instantly share code, notes, and snippets.

View carlin-q-scott's full-sized avatar

Carlin Scott carlin-q-scott

View GitHub Profile
<?xml version="1.0" encoding="utf-8" ?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputWebroot>$(TargetDir)</OutputWebroot>
</PropertyGroup>
<ItemGroup>
<gruntInputs Include="Gruntfile.js"/>
<gruntInputs Include="app/**/*.js"/>
<gruntInputs Include="app/**/*.html"/>
<gruntInputs Include="content/**/*"/>
@carlin-q-scott
carlin-q-scott / ReferenceResolverWithNames.cs
Last active April 28, 2024 18:05
A JSON.Net IReferenceResolver that resolves field references using a Name property if available, otherwise it uses an index
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json.Serialization;
namespace MyNewtonsoftExtensions
{
public class ReferenceResolverWithNames : IReferenceResolver
{
private readonly ReferenceCollection _collection = new ReferenceCollection();
@carlin-q-scott
carlin-q-scott / pandora-next-track.js
Last active April 14, 2016 18:38
Method for notifying user of new tracks on Pandora.com
function notifyNewTrack(mutation){
new Notification("Now Playing", {
body: document.querySelector('.trackData').innerText
})
}
Notification.requestPermission() //normally you'd handle the response and accept rejection but whatev's.
var currentTrackObserver = new MutationObserver(notifyNewTrack)
currentTrackObserver.observe(document.querySelector('#trackInfoContainer'), {
@carlin-q-scott
carlin-q-scott / keycodeCaptor.js
Last active June 28, 2016 06:47
Detect Media Key events on MacOSX
/*jshint moz: true, undef: true, unused: true */
/*global ctypes, require, console, exports */
let { Cu } = require('chrome');
let { setTimeout } = require('sdk/timers');
Cu.import('resource://gre/modules/ctypes.jsm');
var objc = ctypes.open(ctypes.libraryName('objc'));
var is64bit = ctypes.voidptr_t.size == 4 ? false : true;
@carlin-q-scott
carlin-q-scott / remove-google-hangouts-links.js
Last active February 4, 2017 21:03
WIP: This will remove Google Hangouts links from Google pages so that you can use your own dialer
@carlin-q-scott
carlin-q-scott / .travis.yml
Created February 9, 2017 14:36
travis-ci build for firefox add-ons
language: node_js
node_js:
- "stable"
env:
global:
- DISPLAY=:99.0
- FIREFOX_BIN=./firefox/firefox
- JPM_FIREFOX_BINARY=./firefox/firefox
/// <summary>
/// Note that if this is the end of your assertion chain then append () or .Invoke() to the end
/// </summary>
/// <param name="action"></param>
/// <param name="time"></param>
/// <param name="precision"></param>
/// <returns></returns>
public static Action ShouldTakeCloseTo(this Action action, TimeSpan time)
{
$credential = $Host.ui.PromptForCredential("Need your domain account credentials", "Please enter your domain user name and password", $null, "NetBiosUserName")
# use -Credential $credential for some of the powershell commandlets. Copy-Item takes in this param but can't use it.
# Problem: Build servers check out tags to build them but we need to deploy our code based on the branch the code came from.
# Solution: Get branches containing the tag, figure out which one has the tagged commit as its head
$ git branch --contains tags/some-tag
* (HEAD detached at some-tag)
demo/carlin
demo/steve
$ git diff --shortstat demo/steve some-tag
@carlin-q-scott
carlin-q-scott / Enum.js
Created October 10, 2018 20:32
Attempt at creating an enum using Proxy and Class
class Enum extends Proxy {
constructor(...names) {
let members = Object.create(null);
members.tryParse = name => {
if (!members[name]) {
throw new Error(`Unable to parse '${name}' as an Enum member.`);
}
return members[name];
};