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
// I find it useful to read expr1 && expr2 as "if expr1 is true, than expr2" | |
// By definition, expr1 && expr2 returns expr2 if expr1 can be converted to true; otherwise, it returns expr2. | |
// Seeing things through an if statement helps me build this sort of mental shortcut. | |
function and(expr1, expr2) { | |
if (Boolean(expr1) === true) { | |
return expr2; | |
} | |
return expr1; | |
} |
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
// ['1', '2', '3'].map(parseInt) returns [1, NaN, NaN]; why? | |
// simplified `map`, to be able to step into the code through the debugger | |
function map(array, callback) { | |
var mappedArray = []; | |
for (var i = 0; i < array.length; i++) { | |
mappedArray[i] = callback(array[i], i, array); | |
} | |
return mappedArray; | |
} |
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
// jake you forgot the end parameter, added! | |
function copyWithin(originalArray, target, start, end) { | |
var originalLength = originalArray.length; | |
var elementsToCopy = []; | |
// the vars I need to break down the problem | |
var copyFrom, copyTo, pasteFrom, pasteTo; | |
// set copyFrom | |
// if undefined let's set it to 0 |
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 copyWithin (array, startPasting, startCopying, endCopying) { | |
/* TYPE ERRORS */ | |
// no arguments passed in | |
if (arguments.length === 0) { | |
throw new TypeError('undefined is not an array'); | |
} | |
// The following is taken from underscore.js. Basically it checks if the length property of arguments[0] is there | |
var shallowProperty = function (key) { | |
return function (obj) { |
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
edit: function (event) { | |
var labelEl = event.target; | |
var liEl = labelEl.closest('li'); | |
var inputEl = liEl.lastElementChild; | |
var len = inputEl.value.length; | |
liEl.className = 'editing'; | |
inputEl.focus(); | |
inputEl.setSelectionRange(len, len); |
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() { | |
var libraryStorage = {}; | |
function loadLibrary(libraryName, dependencyNames, addLibrary) { | |
var dependencyValues = []; | |
if (dependencyNames.length !== 0) { | |
dependencyValues = dependencyNames.map(function(dependencyName) { | |
return libraryStorage[dependencyName]; | |
}) | |
} |
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
// my solution | |
// I copied the name of the first parameter from Ben Baik solution because | |
// it's a great choice. Maybe it's redundant because 'runWithDebugger' is | |
// already meaningful. I take no risk: redundant maybe, but superclear! :-) | |
function runWithDebugger(functionToDebug, functionToDebugArgs) { | |
debugger; | |
functionToDebug.apply(null, functionToDebugArgs); | |
} |
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
<RecordType id="002"> | |
<NameSize>A</NameSize> <!--Taglie componenti codice--> | |
<CodeSize>48@M1#1,50@M1#1</CodeSize> <!--Taglie componenti--> | |
<MarkerName>A.gbr</MarkerName> <!--Nome del marker--> | |
<Length>101</Length> <!--Lunghezza del marker in cm--> | |
<OverlapsMarker>34,45</OverlapsMarker> <!--splice in cm--> | |
</RecordType> |
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
' CICLO TACCHE --------------------------------------------------------------------------------------------------------- | |
strNotches = "" | |
Dim dvNotches As New DataView(gdtSegment) | |
dvNotches.RowFilter = "IdPattern = " & shtCSVPattern & " AND SegType = 10" | |
dvNotches.Sort = "SegSeq" |
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
f |
NewerOlder