Categories
Samuel Sass

Setting Up WordPress with Sass and Browser Sync

This post is mainly a helpful reminder reference to my future self so please excuse the lack of polish on this article.

Outline:

  • Create a package.json file with all the needed dependencies to get Sass + Browser sync working
  • Install all dependencies using NPM
  • Activate Gulp Watch + Browser-sync to enjoy lighting fast developing

Creating Json File:

Initially its best to create this file from the command line, so open terminal in php storm, navigate to the sites theme file and run the npm commands, which will generate this file:

{
  "name": "SassAutomation",
  "version": "0.0.1",
  "description": "Quick & dirty SASS automation for WP Theme",
  "author": "Sam",
  "devDependencies": {
    "gulp": "^3.8.11",
    "browser-sync": "^2.26.7",
    "gulp-ruby-sass": "^1.0.5",
    "gulp-sass": "^4.0.2",
    "gulp-sourcemaps": "^1.5.2",
    "gulp-watch": "^5.0.1",
    "node-sass": "^4.12.0",
  }
}

Setup Gulp File:

We want to create a gulpfile that will watch all of our Sass files for changes. When a change is detected we want this file to re-compile the new sass into our sites main style.css file located in the root directory of the them. The Gulp file below will do all of these operations:

var gulp = require('gulp'),
    sass = require('gulp-sass'),
    watch = require('gulp-watch');
    browserSync = require('browser-sync');
    reload      = browserSync.reload;

gulp.task('sass', function(){
    gulp.src('./scss/style.scss')
        .pipe(sass().on('error', sass.logError))
        .pipe(gulp.dest(''))
        .pipe(reload({stream:true}));
});

// browser-sync task for starting the server.
gulp.task('browser-sync', function() {
    //watch files
    var files = [
        './scss/*.scss',
    ];

    //initialize browsersync
    browserSync.init(files, {
        //browsersync with a php server
        proxy: "http://localhost/folder-name",
        notify: true
    });
});

gulp.task('default', ['sass', 'browser-sync'], function() {
    gulp.watch('./scss/**/*.scss', ['sass']);
});

Notes about the code above:

  • Line 4 calls in browser sync which will open a new window when you run the gulp command
  • Line 5 and line 10 forces the auto refresh of the browser window anytime a change is made, which is super handy as it removes the need to constantly manually refresh the local environment to see our chagnes
  • The line that starts with “proxy” identifies where the site should display. In this instance I’m using WAMP which generates a URL of localhost. The “folder-name” at the end of the line can be replaced with whatever folder the site lives in. So IE if the site was in WAMP – > WWW -> altec the proxy line would be: http://localhost/altec

Categories
Samuel Sass

Sass Essentials Notes

Error Message:

gulp internal/modules/cjs/loader.js:638 cannont find module 'gulp-ruby-sass'

Fix:

npm update 
npm install gulp-sass --save-dev

Error Message:

npm WARN gulp-jshint@2.1.0 requires a peer of jshint@2.x but hone is installed

Fix:

npm install jshint

Error Message:

Local gulp not found in C:\\filepath

Fix:

npm install gulp
Categories
Quotes Samuel

A Few Good Quotes

When you’re frantically trying to get ahead of the pack, sometimes you forget to check in and see if the pack is actually headed in the right direction. 

To be “bored” is to be free of distraction. I have configured servers, written code, built web pages and designed sites seen by hundreds of thousands of people. I am firmly in the camp that believes technology is generally bending the world in a positive direction. Yet it seems twitter foments neurosis, Facebook sadness, Google News a sense of foreboding. All social networking sites make me want to do it – whatever “it” may be – for the likes, the comments. I can’t help but feel that I am the worst version of myself, being performative on a very short, very depressing timeline. In the context of “boredom” as a goal, the antipode of the mindless connectivity, constant simulations, anger and dissatisfaction. I put “boredom” in quotes because the boredom I’m talking about fosters a heightened sense of presence. To be “bored” is to be free of distraction.

Categories
Fixing Stuff Samuel

Fixing Problem Printing On New Google Calendar

I had been having difficulty printing after Google Chrome updated to the latest version, which at the time of this writing is: 75.0.3770.100. I can choose settings print or hit Control + P and the print preview box shows up, but then when the actual print button is clicked nothing happens. The preview window disappears and no print job is started. There is also no error or warning message displayed.

This fix should work for any version of Chrome but check your version you can click the three dots in the upper right hand corner of the screen then select Help -> About Google Chrome

The Fix For This Issue:

Go to Settings -> Advanced -> Site Settings -> Pop-ups and redirects. Add http://calendar.google.com to the “Allow” list then go back to your calendar page and hit control + p, the print function should now be back working 🙂

—If this still does not work, an alternative workout is to hit control + shift + p and that will open your computers default print dialog box and you can print the calendar from there without a preview

Categories
Kids Samuel

What I’ll Teach My Daughter About Self Defense

I originally posted this as a comment on a blog but wanted to save it for later

The original Comment was posted here: https://elladawson.com/2018/11/20/in-case-i-am-ever-murdered-by-a-man/comment-page-1/#comment-21885

I just stumbled across your blog today, and this is the 2nd post I’ve read. Both have been amazing, I’m excited to read more of your writing! After reading this post I was compelled to comment and offer a hopefully helpful perspective.

It is a very scary thought to have the deep seated fear of gun violence being thrust upon you by a man. However fear can be eliminated or at least greatly minimized by having a plan. If you stop to think of many great fears in life, the part that paralyzes most of us is the uncertainty. What will happen if….

When you wrote :

“I imagined what I would do if one of these men Burst into the room with a gun. I imagined what I might say to try and reason with him. Would one of the students call the police in time?”

In my opinion this is the wrong way to look at the problem, and the wrong message to share with other women. I don’t have a daughter, but if I’m lucky enough to one day have a daughter I will absolutely teach her some variation of this plan:

If someone ever threatens you with a gun, or with physical violence of any kind you need to have a plan. A concrete set of actions you are going to take to give yourself and the people around you the best chance of survival. The time for discussion and reasoning with this person is over. They are threatening your life. You can’t put your faith in law enforcement to be able to arrive in time to save you. And regardless you are powerful, you don’t need saving, you can save yourself.

First understand that when you call the police, you are calling someone that has roughly 100 hours of active firearms training. When put in that context would you spend 100 hours of your life training so that you could save yourself? Instead of praying or hoping for outside rescue let’s do the following:

  • Buy a small can of pepper spray/mace. Carry it with you in your purse at all times. And I mean ALL TIMES. Being prepared helps take the fear out of the situation.
  • Practice using the mace. Do this enough times that you don’t have to think about getting it out of your purse and using it. You don’t’ have to fire the mace each time, but practice the physical act of finding the mace in your purse, aiming it and discharging it.
  • To remove or diminish your fear of guns, take a weekend firearms training course. Learn how to use a gun, how to load and unload it. You don’t have to like guns, in fact you can hate them. But don’t let this hate diminish your chance of surviving an encounter with a gun.
  • Learn about distance and spacing in a fight. Learn that if someone has a gun and you have no way to escape or run, it’s actually safer for you to be closer to them. Guns are tools meant to be used at distance, up close mace or a knife is much more effective than a gun. Learn how to calmly talk and move towards the assailant in a non-threatening manner so you can close the distances and get close enough to disarm and attack them. ALL of these techniques can be learned at a martial arts studio, or at a self-defense class.
  • Practice closing distance and space until you are able to do it without a second thought. Much like being able to calmly and easily use the mace, repeating these physical motions until your muscle memory can take over for you is key, in real life you won’t be able to think. Fear will take over and paralyze you.
  • Learn how to spot weapons of opportunity around you. A belt is an effective tool against and attacker with a knife. A high heeled shoe, a phone, a book, all of these objects can be thrown and someone to distract or disorient them if they are too far for you to reach.

The ideas above are just the tip of the iceberg; I’m not a certified self defense expert. If you read the ideas above and your initial reply is “I should not have to learn these types of techniques” or “we should not live in a world where anyone needs this type of knowledge”. I 100% agree with those thoughts! I’m on your side of this debate, I just feel that along with campaigning for better large scale social policies we can also impact our own safety with training and knowledge. The sad fact is we currently do live in a world that requires this type of knowledge. Denying that, and putting our own safety into other people’s hands doesn’t help ourselves, and it doesn’t help anyone around us. With luck we might someday live in a society where violence is not a problem, but until that day the best course of action, to me, is to have a plan to deal with it. With any luck we will save our own lives, and innocent lives of people around us.

Categories
Thought Experiment

Everything Were Doing Today Might Not Matter In 10 Years – A Thought Experiment

This is a thought experiment that I find extremely helpful. It allows me to not take myself or my work too seriously. It also empowers me to not feel the need to grind myself day in and day out, to be productive and contribute to society. Not to say that I don’t want to do those things, but ultimately I understand and accept that everything we do, everything that humans have done since the beginning of our existence, might not matter.

The scenario: Earth is hit by an asteroid 10 years from now. We can’t avoid it, we cant do anything to stop it. The entire human race is wiped out…. I know a bummer of a thought right!

With that thought in mind its important to not demand too much of yourself. It’s ok if you spend an entire day drinking and flirting and talking with someone you love. It’s ok if you don’t get up early and attack the day. It’s completely fine if you don’t get anything on your to-do list done but instead crush a workout and then spend the rest of the day just sitting quietly and contemplating a thought or an idea. You don’t need to schedule activities for yourself every day. You don’t owe the world around you anything, other than to be kind to everyone you see today.

The rushed/hurried pace that most of society lives with is not necessary.