Skip to content

Instantly share code, notes, and snippets.

@Jerph
Jerph / SwapMacKeys.ahk
Created August 1, 2019 21:52
AutoHotKey script to swap Option<->Command (Alt<->Win) in bootcamp
; Swap Option<->Command (Alt<->Win) in Boot Camp. Disable with Ctrl+F6. Only swaps left alt, use right alt for Ctrl+Alt+Del
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
#InstallKeybdHook
#SingleInstance force
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; swap left command/windows key with left alt
@Jerph
Jerph / DocumentTab.js
Last active June 1, 2017 00:45
Using child components props harmful?
class DocumentTab extends React.Component {
static propTypes = Tab.propTypes;
static defaultProps = Object.assign({}, Tab.defaultProps, {
title: "Document Builds",
});
render() {
const { document_builds, ...props } = this.props;
return (
@Jerph
Jerph / jquery.trimTextInputs.js
Last active December 18, 2015 15:39
jQuery plugin to trim text inputs on change
/*!
* jquery.trimTextInputs.js v1.0.0
*
* Copyright 2013, Jeff Fendley
* Dual licensed under the MIT or GPL Version 2 licenses.
*
*/
(function ($) {
// Trims text inputs on change
$.extend({
@Jerph
Jerph / ConventionBasedFormattingExtensions.cs
Last active December 18, 2015 02:19
My take on splitting intercased words (camelCase or PascalCase) into separate words. It handles numbers and strings of capitalized words according to the most common conventions.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using System.Text.RegularExpressions;
using System.Web.Configuration;
namespace System
{
@Jerph
Jerph / jquery.valOrText.js
Created March 4, 2013 21:15
jquery plugin for accessing val(), or if that's empty, text(). Also calls the write version of both functions. Useful for changing the displayed text on buttons that can be either inputs or links.
jQuery.fn.valOrText = function (textString) {
if (textString === undefined) {
if (this.length == 0)
return this.val();
else
return this.val() || this.text()
} else {
this.val(textString);
return this.text(textString);
}
@Jerph
Jerph / Html5Tag.cs
Created December 3, 2012 15:22
ASP.NET Generic HTML5 Tag control for IE7 support
using System.Web.UI;
using System.Web.UI.WebControls;
public class Html5Tag : PlaceHolder
{
public string TagName { get; set; }
public string FallbackTagName { get; set; }
public string CssClass { get; set; }
public Html5Tag()