Skip to content

Instantly share code, notes, and snippets.

@examinedliving
examinedliving / jq to filter by value.md
Last active January 22, 2021 20:41 — forked from ipbastola/jq to filter by value.md
JQ to filter JSON by value

JQ to filter JSON by value

Syntax: cat <filename> | jq -c '.[] | select( .<key> | contains("<value>"))'

Example: To get json record having _id equal 611

cat my.json | jq -c '.[] | select( ._id | contains(611))'

Remember: if JSON value has no double quotes (eg. for numeric) to do not supply in filter i.e. in contains(611)

From Command prompt on windows, it's like so: (use more if you don't have cat - or get cat)

@examinedliving
examinedliving / monokai-pro-alt.css
Created October 5, 2020 15:28
Color scheme created from monokai-pro
.b-colors__color--11 {
background: #ff2e62;
}
.b-colors__color--12 {
background: #ff7733;
}
.b-colors__color--13 {
background: #ffcc33;
}
.b-colors__color--14 {
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\CLSID\{0E270DAA-1BE6-48F2-AC49-4E2781B29975}]
@="Creative Cloud Files"
"System.IsPinnedToNameSpaceTree"=dword:00000000
[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{0E270DAA-1BE6-48F2-AC49-4E2781B29975}]
@="Creative Cloud Files"
"System.IsPinnedToNameSpaceTree"=dword:00000000
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\CLSID\{0E270DAA-1BE6-48F2-AC49-4E2781B29975}]
@="Creative Cloud Files"
"System.IsPinnedToNameSpaceTree"=dword:00000000
[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{0E270DAA-1BE6-48F2-AC49-4E2781B29975}]
@="Creative Cloud Files"
"System.IsPinnedToNameSpaceTree"=dword:00000000
@examinedliving
examinedliving / axios-download.js
Created July 23, 2020 17:20
Download Excel file with axios
export function someFunction(values) {
return (dispatch) => {
...
const method = 'GET';
const url = 'http://go.api/download_file';
@examinedliving
examinedliving / arrayToObject.js
Last active July 13, 2020 21:48
Converts array of Objects to Object of Objects with optional key name
function arrayToObject(array, key) {
var initialValue = {};
var _key = {};
return array.reduce((obj, item) => {
return {
...obj,
[item[key]]: item,
};
}, initialValue);
}
@examinedliving
examinedliving / tiny-mce-colors.scss
Created July 7, 2020 20:15
Tiny MCE Popup color palette colors. Good color scheme
$green-light:#BFEDD2;
$yellow-light:#FBEEB8;
$red-light:#F8CAC6;
$purple-light:#ECCAFA;
$blue-light:#C2E0F4;
$green:#2DC26B;
$yellow:#F1C40F;
$red:#E03E2D;
$purple:#B96AD9;
@examinedliving
examinedliving / bootstrap-4-sass-mixins-cheat-sheet.scss
Created April 4, 2020 00:32 — forked from anschaef/bootstrap-4-sass-mixins-cheat-sheet.scss
Bootstrap 4 Sass Mixins [Cheat sheet with examples]
/* -------------------------------------------------------------------------- */
// All Bootstrap 4 Sass Mixins [Cheat sheet]
// Updated to Bootstrap v4.4.x
// @author https://anschaef.de
// @see https://github.com/twbs/bootstrap/tree/master/scss/mixins
/* -------------------------------------------------------------------------- */
// Grid variables
$grid-columns: 12;
$grid-gutter-width: 30px;
@examinedliving
examinedliving / zipuppalette-thecolor-of-the-soul.txt
Created December 13, 2019 22:06
Zipup Palette that seems to have idsappeared from the web. Good color mix
--- #1f2652;
--- #0e113a;
--- #ee3466;
--- #c42754;
--- #00b0ad;
--- #018790;
--- #fef79c;
--- #fed883;
--- #523b58;
--- #362337;
@examinedliving
examinedliving / Capitalize.vb
Created November 22, 2019 16:48
Visual Basic Function to capitalize the first letter of the first word in a string that may or may not include multiple words.
Private Function Capitalize(str As String) As String
Dim newStr As String = String.Empty
If str IsNot Nothing Then
Dim l As New List(Of String)(str.Split(" "c))
Dim st As String = l(0)
Dim f As String = st.Substring(0, 1)
Dim rest As String = st.Substring(1)
newStr = String.Join(" ", l).Replace(st, "")
newStr = $"{f.ToUpper() & rest} {newStr}"
newStr = newStr.Replace(" ", " ")