Skip to content

Instantly share code, notes, and snippets.

View jdforsythe's full-sized avatar

Jeremy Forsythe jdforsythe

View GitHub Profile
@jdforsythe
jdforsythe / rolling-links.css
Created February 3, 2014 00:55
Rolling Links on Hover
*, *:before, *:after {
/* Chrome 9-, Safari 5-, iOS 4.2-, Android 3-, Blackberry 7- */
-webkit-box-sizing: border-box;
/* Firefox (desktop or Android) 28- */
-moz-box-sizing: border-box;
/* Firefox 29+, IE 8+, Chrome 10+, Safari 5.1+, Opera 9.5+, iOS 5+, Opera Mini Anything, Blackberry 10+, Android 4+ */
box-sizing: border-box;
}
@jdforsythe
jdforsythe / indesign-add-color-to-document.jsx
Last active August 29, 2015 14:03
InDesign: Add color to document function
function addColor(doc, colorName, colorModel, colorValue){
if (colorValue instanceof Array == false) {
colorValue = [(parseInt(colorValue, 16) >> 16 ) & 0xff, (parseInt(colorValue, 16) >> 8 ) & 0xff, parseInt(colorValue, 16 ) & 0xff ];
colorSpace = ColorSpace.RGB;
}
else {
if(colorValue.length == 3)
colorSpace = ColorSpace.RGB;
else
colorSpace = ColorSpace.CMYK;
Public Class uiFrmDragDropTest
Private Sub uiFrmDragDropTest_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' Me.AllowDrop = True
' TextBox1.AllowDrop = True
End Sub
'' form drag-drop
Private Sub uiFrmDragDropTest_DragEnter(sender As Object, e As DragEventArgs) Handles Me.DragEnter
If (e.Data.GetDataPresent(DataFormats.FileDrop)) Then
@jdforsythe
jdforsythe / Sublime Tips
Created October 16, 2014 14:50
Tips and tricks for Sublime Text
Cursor on all lines:
CTRL+A then SHIFT+CTRL+L
Cursor on every nth line:
CTRL+F, turn on RegEx, use (.*(\n|$)){n}
then press ALT+ENTER to find all
then press LEFT arrow to remove the selection and get the cursors
@jdforsythe
jdforsythe / bumpversion.sh
Created March 13, 2015 04:07
bumpversion.sh
#!/bin/bash
oldnum=`cut -d '"' -f2 version.php`
echo "Current version is $oldnum"
echo "Enter new version:"
read version
echo "<?php echo \"$version\";" > version.php
@jdforsythe
jdforsythe / replace-line-breaks.js
Created July 31, 2015 11:36
Javascript - replace line breaks in string with br tags
// see http://stackoverflow.com/a/784547
function replaceLineBreaks(str) {
return str.replace(/(?:\r\n|\r|\n)/g, '<br>');
}
@jdforsythe
jdforsythe / IncrementNumbersCommand.py
Created August 11, 2015 13:12
Increment multiple selected numbers in SublimeText
import sublime, sublime_plugin
class IncrementNumbersCommand(sublime_plugin.TextCommand):
def run(self, edit):
start_value = int(self.view.substr(self.view.sel()[0]))
counter = 0
for selection in self.view.sel():
self.view.insert(edit, selection.begin(), str(start_value + counter))
counter = counter + 1
@jdforsythe
jdforsythe / connect.ps1
Last active October 23, 2024 11:54
Remote Desktop Auto Login Powershell Script
cmdkey /list | ForEach-Object{if($_ -like "*target=TERMSRV/*"){cmdkey /del:($_ -replace " ","" -replace "Target:","")}}
echo "Connecting to 192.168.1.100"
$Server="192.168.1.100"
$User="Administrator"
$Password="AdminPassword"
cmdkey /generic:TERMSRV/$Server /user:$User /pass:$Password
mstsc /v:$Server
@jdforsythe
jdforsythe / ConvertTwoSpacesToFour.sublime-macro
Created August 18, 2015 12:25
ST2 or ST3 macro to convert 4-space indentation to 2-space indentation
[
{
"args": null,
"command": "select_all"
},
{
"args": {
"setting": "tab_size",
"value": 4
},