Skip to content

Instantly share code, notes, and snippets.

View ntodorov's full-sized avatar

Nik Todorov ntodorov

View GitHub Profile
#fixed now!
Param(
[string]$html,
[string]$docx
)
# make the powershell process switch the current directory.
$oldwd = [Environment]::CurrentDirectory
[Environment]::CurrentDirectory = $pwd
@ntodorov
ntodorov / getByPropertyChain.js
Last active March 23, 2019 02:13
if you ever need to get value from a property that is deep in the chain and you do not want to do check for every level and still to not get an exception, this gist will help you out
const getByPropertyChain = (obj, chain) => {
const ca = chain.split('.')
return ca.reduce((acc, property) => acc && acc[property], obj)
}
//Example:
const testObj = {a: 1, b: {d: 0, e: {z:{q:4}}}, c: 5}
getByPropertyChain(testObj, 'b.e.z.q')
//try it out here https://runkit.com/niktv/5c8207eef650670015c2ac43
@ntodorov
ntodorov / index.html
Last active June 29, 2016 22:05
How to add a button to clone the current row (backgrid, backbonejs)
<!DOCTYPE html>
<html>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.css">
<!--<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/backgrid.js/0.3.7/backgrid.css">-->
<head>
<meta charset="utf-8">
<title>nik's backgrid clone row</title>
</head>
@ntodorov
ntodorov / knockoutjs_bootstrap_radiobuttons_group.html
Last active November 18, 2015 21:02
knockoutjs, bootstrap and dynamic radio buttons group
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>knockoutjs, bootstrap and dynamic radio buttons group - jsFiddle demo by ntodorov</title>
<script type='text/javascript' src='//code.jquery.com/jquery-2.1.3.js'></script>
<link rel="stylesheet" type="text/css" href="/css/result-light.css">