Skip to content

Instantly share code, notes, and snippets.

View inderpreet99's full-sized avatar

Inderpreet Singh inderpreet99

View GitHub Profile
@inderpreet99
inderpreet99 / wp-import-automatch-users.js
Last active May 2, 2016 19:51
During WP Import, run the following script in Chrome DevTools console to assign authors automatically. Make jQuery contains case-insensitive for best results: http://stackoverflow.com/questions/187537/is-there-a-case-insensitive-jquery-contains-selector
jQuery('#authors li').each(function(index) {
var user = jQuery(this).find('strong').text();
var re = /^(.*)\s\(([\w\s]*)\)/;
var match = user.match(re);
var name = match[1];
var username = match[2];
console.log('user: ' + user);
var usermap = jQuery(this).find('select');
var select_username = jQuery(usermap).find('option:contains("' + username + '")').attr('selected', true);
if ( select_username.length == 0 ) {
@inderpreet99
inderpreet99 / install-wpcs.sh
Created August 22, 2017 21:01
install wpcs
brew install php-code-sniffer
composer global require wp-coding-standards/wpcs
phpcs --config-set installed_paths ~/.composer/vendor/wp-coding-standards/wpcs/
@inderpreet99
inderpreet99 / finder-open-iterm-here.scpt
Last active March 1, 2020 17:49 — forked from cowboy/finder-open-iterm-here.scpt
Finder Open iTerm Here: Drop a folder on this script (or just run it) to open a new iTerm window there. If the selected item isn't a folder, it will open the item's parent folder. Great when bound to a hotkey in FastScripts or added to the Finder Sidebar. Works with iTerm2-v3 (2.9)
(*
* Finder Open iTerm Here - v1.0.2 - 4/14/2011
* http://benalman.com/
*
* Copyright (c) 2011 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*)
tell application "Finder"
@inderpreet99
inderpreet99 / mypy_ignore_problems.py
Created August 23, 2021 14:00
Ignore MyPy errors by adding ignore comments using sed
import re
import subprocess # nosec
from typing import Callable, List
def uniq(arr: List[str]):
d = {}
for item in arr:
d[f"{item[0]}:{item[1]}"] = item[2]
@inderpreet99
inderpreet99 / yahoo-fantasy-football-drag-drop-waivers.js
Created September 29, 2021 02:52
Drag drop waivers rather than using dropdowns on Yahoo Fantasy Football edit waivers page
// works on https://football.fantasysports.yahoo.com/f1/483108/1/editwaivers pages
YUI().use('sortable', function (Y) {
var sortable;
// Our sortable list instance.
sortable = new Y.Sortable({
container: '.Table tbody',
nodes : 'tr',
opacity : '0.1'