Skip to content

Instantly share code, notes, and snippets.

View lastobelus's full-sized avatar

Michael Johnston lastobelus

View GitHub Profile
@lastobelus
lastobelus / Dates and special characters.alfredsnippets
Last active April 7, 2021 00:04
Alfred Snippets used in Obsidian
function glone {
gh_url=${1:-`pbpaste`}
repo_name=$(basename $gh_url | sed -e 's/\.git//')
co_dir=${HOME}/github/${repo_name}
if [ -d $co_dir ]; then
cd $co_dir && git pull origin master
else
git clone "${gh_url}" "${co_dir}" && cd "${co_dir}"
fi
@lastobelus
lastobelus / -
Created November 24, 2016 04:51
Date/Time Summary
11/23/16 11:48 PM Delivered: postmaster@mg.teesforthepeople.com → Sales@sanmarcanada.com 'Purchase order for Shirt Goods from Teesforthepeople.com'
{
"tags": [
"goods-request",
"provider-request"
],
"envelope": {
"transport": "smtp",
var outerFunction = function(){
if(true){
var x = 5;
//console.log(y); //line 1, ReferenceError: y not defined
}
var nestedFunction = function() {
if(true){
@lastobelus
lastobelus / while-for-bench.js
Last active January 21, 2016 03:48
Quick and dirty benchmarks of for vs negative while loop in javascript
var i = 100000;
var myArray = [];
while(i--) myArray[i] = i;
myArray[0];
console.log("------- for loop always evaluating length-------")
var forResult = 0; console.time("for"); for(var i=0; i < myArray.length; i++) { forResult += myArray[i] }; console.log("forResult: %i", forResult); console.timeEnd("for");
console.log("------- for loop with length in var-------")
var forResult2 = 0; console.time("for2"); for(var i=0, len = myArray.length; i < len; i++) { forResult2 += myArray[i] }; console.log("forResult2: %i", forResult2); console.timeEnd("for2");
function bob(){
console.groupCollapsed("in bob");
console.log("calling mary");
mary();
console.log("back in bob");
console.groupEnd();
}
function mary() {
console.group("in mary");
<html>
<head>
<script>
// Inline javascript
</script>
<script src=“external_javascript.js”></script>
</head>
<body>
<html>
<head>
</head>
<body>
<h1>Output</h1>
<div id="output"></div>
<script type="text/javascript">
</script>
</body>
</html>
<html>
<head>
<script type="text/javascript">
</script>
</head>
<body id="output"></body>
</html>