How to vertically center a div and keep it there on refresh / resize with javascript

I used this code to center a div vertically and have it centered no matter what the window size is and even if it’s resized.

(function() {
	var setpad = function(){
	        var wh = window.innerHeight;  //get the height of the browser window
		var hh = $('#yourheaderid').height();  //get the height of the page header
		var dh = $('#divyourcenteringid').height(); //get the height of the div you're trying to center
		var padpx = (wh - hh - dh) / 2;  //do some math
		var styles = {
			'padding-top' : padpx,
			'padding-bottom' : padpx
		}
		$('#backdiv').css(styles);
	};
	setpad();
	window.onresize = setpad;
});

How to actively monitor a text / log file in linux

Sometimes when your developing and debugging scripts you need to check your error log file to see what might be failing. In the past I’ve used the cat command to just display the last X entries of the log. For whatever reason today it stopped working and gave me a strange error.
sudo cat tail -10 error.log
cat: invalid option -- '1'
Try `cat --help' for more information.

Well I didn’t end up finding out why, rather I found a way to have it watch the file and update me every interval of seconds using this code:


watch -n 2 tail -n 15 mylogfile.txt

Basically watch is set to refresh every 2 seconds, and tail is pulling back 15 results and mylogfile.txt is the name of your file.

Enjoy

Perspective is everything

How we perceive something can change our happiness towards it, or unhappiness towards it.

As business owners we can help change someones perception of something to increase their satisfaction of it.

Your Ideal Life

Ideally, your life would be ideal.

It would have all of the things you want, and would lack all of the things you didn’t.
It would read like a wedding speech, brimming with embellishments, and negativity free.
Your behavior would be exacting, flawless.
You would move through the world effortlessly.
Inevitably enhancing anything in your proximity.

But your life isn’t ideal. You don’t have everything you want. And your behavior is far from perfect.

How can we step up our game?

What does your ideal life look like?

I don’t know what my ideal life looks like.  I think every now and then, oh, i should do this more, or do this less, but I let it exist as a passing thought.

I want to eat more vegetables.  And then it goes away, and I don’t eat more vegetables.

I’ve decided I’m going to write out my ideal life.

Ideal Life:

 

Ideal Morning
Sleep for 7-8 hours
Wake up at 5am
Stretch
Warm up
Workout
Make Coffee
Shower
Have Coffee outside on the porch in the sun
Sit and think, plan my day, reflect, Journal

Ideal Work Day (in a job)
Assemble Lunch
Drive to work
Do work
Workout at 10am
Eat Lunch at 11:30
Have snack at 2:30
Stretch
Mid Day Journal
Leave work

Ideal End of day:
Get kids
bum around before dinner
eat dinner
hang out, play, talk
Kids bedtime
hang out talk with spousicle
journal – Interesting to note, this is the only thing I feel I’m missing
bed

I’m thinking now that maybe this exercise should have started with me writing out the things I feel like I’m missing, or want to be doing and aren’t.

eating more vegtables
working out in the morning (at all really)
Journaling before bed

Now I’m feeling like this needs to be more of a rolling list, because I can’t think of everything right now.

Maybe adding things that I do occasionally, and enjoy and would like to do more off

having coffee on the porch
taking pictures for fun
doing fun things (this is especially hard for me to remember)

I’m realizing this goes back to my app i want to make.  Which should be able to tell me these things.

Choice, less is more

I watched a TED Talks.

These are some notes.

Barry Schwarz – The paradox of choice

Too many choices leads to paralysis.

Why Choice makes People Miserable:

1. Regret and anticipated regret –

  • I’m Less satisfied with my choice if there are more choices because it’s easy to imagine I could have made a better choice.
  • What if I choose this and hate it?
  • Regretting the decision, subtracts from the enjoyment of the decision you made

2. Opportunity Costs –

  • I choose this, but what about all those other choices maybe they were better, I like my choice less now.
  • opportunity costs subtract from what we choose even if what we choose is terrific

3. Escalation of Expectations –

  • Because there are so many choices, I’m expecting that my choice will be perfect.

4. Self-Blame –

  • All those choices and I’m not happy with my choice, therefore I suck at making choices.

 

This is what we all are working off now, the incorrect “Official Dogma”

Maximize welfare

This means maximize freedom

This means maximize choice

More choice means more freedom

More freedom means more welfare

FALSE!

 

Some choice is better than none, but more choice is not better than some.

 

What is Purpose

Purpose, my purpose, should be independent of the medium or tool that is used to achieve it.

If I take photos of blue whales when they swim at the bottom of the ocean because they start to glow and I want the world to know about this strange phenomenon, I have purpose.  The camera is the tool, and the photos the medium, but I could write a story, or tell a story, or draw a picture, paint and painting, etc.  My purpose is still the same, and therefore exists.  My purpose can’t be , “To take photos”.  Otherwise, without the tool, there is no purpose.

What’s my purpose?  Do I have one?  I don’t know.  I think this definition will help me define it.  I love doing time lapse, and astrophotography, HDR landscapes.  I know that it’s because those things you can’t see without the camera.  Is my purpose to show the world things they can’t normally see?  Maybe.  I feel it has to be something more though.

Secretly (questioning this due to it being published on the internet), my purpose is to just be able to take pictures for a living, but that’s too broad.  Sure, everyone wants to do that.

Truly, this is just a jumping off point.  Find purpose, keep it independent of tools and medium.  Go.