This file contains 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
//concept from http://www.sitepoint.com/multi-threading-javascript/ | |
var $visibleElements = $(":visible"); | |
var random255 = function () { | |
return Math.floor(Math.random()*255); | |
} | |
var randomColor = function () { | |
return "rgb(" + random255() + "," + random255() + "," + random255() + ")"; | |
} |
This file contains 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
#!/usr/bin/env /usr/local/bin/node | |
// <xbar.title>Current ISP name</xbar.title> | |
// <xbar.version>v2.1.7-beta</xbar.version> | |
// <xbar.author>Dan Kordik</xbar.author> | |
// <xbar.author.github>dkordik</xbar.author.github> | |
// <xbar.desc>Displays current ISP name</xbar.desc> | |
// <xbar.dependencies></xbar.dependencies> | |
const http = require("http"); |
This file contains 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
const date = new Date("2022-06-27T00:49:00Z"); | |
// yoinked from https://flaviocopes.com/how-to-list-object-methods-javascript/ | |
const getMethods = (obj) => { | |
let properties = new Set() | |
let currentObj = obj | |
do { | |
Object.getOwnPropertyNames(currentObj).map(item => properties.add(item)) | |
} while ((currentObj = Object.getPrototypeOf(currentObj))) | |
return [...properties.keys()].filter(item => typeof obj[item] === 'function') |
This file contains 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
Show hidden characters
{ | |
"terminal": "C:/Program Files/Console2/Console.exe", | |
// In Console2 "Shell" section, have just "bash" with no args in a profile called "Terminal" | |
"parameters": ["-t", "Terminal", "-r", "/bin/xhere /bin/bash.exe", "`%CWD%`"] | |
} |
This file contains 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
class BulkResponse { | |
String subject; | |
} | |
bulkResponse = new BulkResponse(subject:'Hi Rohit!') | |
//-- | |
class ThreadResponse extends BulkResponse { | |
String campaignName; | |
} |
This file contains 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
#!/bin/bash | |
set -e # exit when a command fails, so we don't continue doing next steps! | |
function check_exists { | |
CMD="$1" | |
# "type" works nicely for checking existence of both shell functions and scripts/bins | |
if type -t "$CMD" 1> /dev/null 2>/dev/null; then | |
true | |
else | |
false |
This file contains 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
#!/bin/sh | |
# | |
# This script will make WinMerge your default tool for diff and merge. | |
# It must run inside git bash (on Windows) | |
# | |
# If your WinMerge is in other place then this one, please edit | |
WINMERGE_SCRIPT="~/winmerge-merge.sh" |
This file contains 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
{ | |
"terminal": "C:/cygwin/bin/mintty.exe", | |
"parameters": ["/bin/env", "CHERE_INVOKING=1", "/bin/xhere", "/bin/bash", "`%CWD%`"] | |
} |
This file contains 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 addCommasToNumber(n) { | |
return n.toString().split('').reverse().join('').match(/(.{1,3})/g).join(',').split('').reverse().join(''); | |
} |
This file contains 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
#uses showlinenum.awk from: https://github.com/jay/showlinenum (needs gawk, brew install gawk) | |
alias gd='git diff --color=always | ~/showlinenum.awk color_line_number=90 color_separator=37 | less -r' | |
alias gds='git diff --staged --color=always | ~/showlinenum.awk color_line_number=90 color_separator=37 | less -r' |
NewerOlder