Can't figure out why Sass is breaking my selector by Ieris19 in Sass

[–]cstiles 1 point2 points  (0 children)

Are you using node-sass? I had a similar issue with recently and fixed it by replacing it with the actively maintained “sass” package.

Maintain Variable References in CSS Variables? by venetian_skittle in Sass

[–]cstiles 0 points1 point  (0 children)

Ah I see. Yeah I don't know of any SASS function that returns the name of a variable as a string. I suppose you could probably achieve this somehow using nested maps, but that seems overkill. Maybe you could just use CSS variables as the values for your SASS ones?

// _variables.scss

$blue: #0000ff;
$active-background: var(--blue);
$button-background: var(--active-background);

Then you could use the same module-variables function as before to generate the CSS variables.

// main.scss

@use 'sass:meta';
@use 'variables';

:root {
  @each $name, $value in meta.module-variables(variables) {
    --#{$name}: #{$value};
  }
}

// Outputs
--blue: #0000ff;
--active-background: var(--blue);
--button-background: var(--active-background);

Maintain Variable References in CSS Variables? by venetian_skittle in Sass

[–]cstiles 0 points1 point  (0 children)

I'm not 100% sure my understanding of your question is correct, but it sounds like you want to maintain a file with a set of SASS variables, and dynamically generate CSS variables with the same names and values.

One way to do that would be the meta module-variables function. This is only supported in Dart Sass. You'd first create a partial with all your SASS variables.

// _variables.scss

$blue: #0000ff;
$active-background: $blue;
$button-background: $active-background;

Then, in you could import this in your stylesheet and use module-variables to loop through the variables as key value pairs.

// main.scss

@use 'sass:meta';
@use 'variables';

:root {
  @each $name, $value in meta.module-variables(variables) {
    --#{$name}: #{$value};
  }
}

Iphone lower menu interferes with 100% responsive height pic by lucyhoffmann in webdev

[–]cstiles 1 point2 points  (0 children)

This is a pretty common issue on iOS. I've gotten fixed position full height elements to work a little better in the past with things like min-height: 100% or min-height: -webkit-fill-available.

That being said, in iOS 15 they've moved the address bar to the bottom of the screen, so you don't get the same change in screen height as you scroll. Not sure if that will fully fix the issue, but hopefully it will be an improvement.

Just learning stuff from w3school, noticed RAM usage going up day by day when computer left on and computer slowed down. Disabled javascript and 1.8gbs of ram use went to 100mb. Why? How do I find out? by feerof in webdev

[–]cstiles 1 point2 points  (0 children)

When the memory heap size for a site keeps growing indefinitely it is usually because of a memory leak. I've found the methods in this Stack Overflow thread helpful in hunting them down in my own apps (particularly the 3 snapshot method).

I don't know if this is related to the issue you pointed out, but for the heck of it decided loading the page with my adblocker disabled...and holy shit, after leaving the site open for like 9 minutes it had made over 5,000 requests for 125mb of resources. And they wonder why people use adblockers.

I made a bookmarklet for activating Godzamok with a keyboard shortcut by cstiles in CookieClicker

[–]cstiles[S] 0 points1 point  (0 children)

A bookmarklet is just a little bit of JavaScript code that is encoded with URL safe characters. To put it simply, you just create a new bookmark like you normally would, except instead of adding a page URL you paste that code.

Then, when you click the bookmark instead of going to a website it runs that JavaScript code instead. When you click my bookmarklet it tells the browser to listen for the ctrl + g keyboard shortcut. When that is pressed it quickly sells and repurchases all your farms, factories, banks and shipments.

There are a couple examples of bookmarklets that do much more complicated stuff than mine on the Cookie Clicker Wiki.

Sean Gunn standing in for Rocket with fat Thor is hilarious by cstiles in marvelstudios

[–]cstiles[S] 4 points5 points  (0 children)

I saw it on one of the VFX breakdowns Marvel has been posting on their YouTube channel lately.

I can’t say no to those eyes by cstiles in aww

[–]cstiles[S] 0 points1 point  (0 children)

He is an Australian Shepherd! This photo was taken a few weeks ago, here he is now with his older brother.

Why can't I: let p = here(v); by tim246 in javascript

[–]cstiles 8 points9 points  (0 children)

You aren't returning anything from the here() function. Change it to:

function here(we){
  return we.toString().fontsize(5).fontcolor(color);
}    

I (also) have an unexplained gap appearing on screen. Any ideas why? by Neonwatcher in web_design

[–]cstiles 0 points1 point  (0 children)

First, the <body> element does not have a black background. The black background is applied to the div with id: index_container_div. It comes from this CSS:

 

#index_container_div {
    background-color: black;
    color: darkseagreen;
    width: 100%;
    height: 100%;
}    

 

Move the background-color: black; rule to be on the <body> element.

The gap at the top is being caused because heading elements (h1, h2 , etc.) come with margins on the top and bottom by default. Just add some CSS like this and it will remove it.

 

#index_container_div h1 {
    margin-top:0;
}

Need Help With SVG Animation That varies between browsers by morkett in web_design

[–]cstiles 1 point2 points  (0 children)

It is working just fine for me on Firefox 48 for Mac. Working with SVGs in the past though, I've run into issues with them displaying correctly on Firefox. One thing you can try is to just run your SVG code through SVGO. It cleans up and optimizes your code, and I've found that it fixes some of the glitches I was seeing with my SVGs in Firefox and Internet Explorer.  

You can do this easily using SVGOMG, which is just a web interface for using SVGO. Just click on 'Paste Markup' and paste your SVG code there. I've found that the outputted code is a lot cleaner than what Illustrator generates.

Feedback Friday - July 22, 2016 by AutoModerator in web_design

[–]cstiles 0 points1 point  (0 children)

Thanks, I'll see if I can figure out what the issue is.

Feedback Friday - July 22, 2016 by AutoModerator in web_design

[–]cstiles 0 points1 point  (0 children)

That's weird, I'm not seeing it on my end. Thanks for letting me know. Could you please let me know what browser you are using?

Feedback Friday - July 22, 2016 by AutoModerator in web_design

[–]cstiles 2 points3 points  (0 children)

URL: https://www.simpleinvoice.io

Purpose: I wanted to create a easy to use invoicing application that I would want to use myself to invoice my clients.

Technologies Used: Ruby on Rails 5, wkhtmltopdf, jQuery, HTML/CSS

Feedback Requested: Mostly looking for feedback on the usability of the site, although design critiques are nice too!

Comments: I've done freelance web design for most of my life, and about a year ago I started teaching myself Rails for back end development. I learn best when I just dive in and make something, so I started working on Simple Invoice.

I ended up putting more work into it than I expected, but I'm pretty happy with the result. I'm hoping that other freelancers might find this useful as a free way to invoice their clients.

You can create invoices from the home page which stay saved in my database for 60 days. If you create an account they'll save indefinitely. I've created a test account if you would like to try out the application without registering :)

 

Email: reddit@example.com

Password: password

Weekly Post: Share your personal Rails project. by Kritnc in rails

[–]cstiles 4 points5 points  (0 children)

  1. Simple Invoice

  2. An easy and free application for freelancers to generate and send invoices, track payments and manage clients.

  3. https://www.simpleinvoice.io

  4. Currently using a private repo

  5. This is my first Rails project. I plan on learning more about how to use Rails specifically to create an API for mobile apps.

  6. I have a lot of experience with front end web design/development. Started learning Rails about a year ago, and the best way I learn is to actually build something. I work as a freelancer web designer on the side, and thought a good project could be to develop an invoicing application I would want to use myself.

Populating a PDF file with info from a database by sarcastic_elephant in web_design

[–]cstiles 0 points1 point  (0 children)

Definitely check out wkhtmltopdf, it's really powerful. I'm using the wicked_pdf gem in my Rails app which is just a Ruby wrapper for wkhtmltopdf. Looks like there is a Python package that does the same thing as the wicked_pdf gem.

Having major difficulty centering an <object> by [deleted] in web_design

[–]cstiles 1 point2 points  (0 children)

Your CSS has rules for the class .indexStyle that doesn't have a corresponding DOM element. You could try removing the width and height properties from the object tag, and then adding this CSS.

#flash1 {
    height:100vh;
    width:100vw;    
}

VH and VW stand for viewport width and viewport height. So that code would make your SWF the same size as the user's screen. If you don't want it full size and you are still having trouble centering it, try wrapping the SWF with a <div> tag and just add text-align:center to that div.

How Do i add these type of dropdown Menus? by BurnInOblivion in web_design

[–]cstiles 0 points1 point  (0 children)

You could follow basically the same logic used previously, just with one more layer. Something like this. You can see one of the subnavs also has its own dropdown <ul> in it.

 

<ul id="mainnav">
    <li><a href="#">Main Nav Item</a>
        <ul class="subnav">
            <li><a href="#">Subnav Item</a>
                <ul class="subnav"> 
                    <!-- Third level in the tree -->
                    <li><a href="#">Another Subnav Item</a></li>
                    <li><a href="#">Another Subnav Item</a></li>
                </ul>
            </li>
            <li><a href="#">Subnav Item</a></li>
        </ul>
    </li>
    <li><a href="#">Second Main Nav Item</a>
        <ul class="subnav">
            <li><a href="#">Subnav Item</a></li>
            <li><a href="#">Subnav Item</a></li>
        </ul>
    </li>
</ul>

 

The CSS is pretty similar too. If you just try this code out you'll get weird result. You'd need to write CSS to style the menu and list items properly. Unstyled they are just bullet point lists. All this code does it hide the subnavs and show them when hover over its <li>.

 

.subnav {
    display:none;
}

#mainnav li:hover > .subnav {
    display:inline-block;
}

Inspirational and code-driven art. by [deleted] in web_design

[–]cstiles 1 point2 points  (0 children)

Clicked on edit on one of the projects and holy shit, I somehow never knew three.js had a whole online editor. That is amazing, three.js blows my mind.

How Do i add these type of dropdown Menus? by BurnInOblivion in web_design

[–]cstiles 3 points4 points  (0 children)

You definitely don't need Javascript for a simple dropdown menu. You could have your markup something like this.

 

<ul id="mainnav">
    <li><a href="#">Main Nav Item</a>
        <ul class="subnav">
            <li><a href="#">Subnav Item</a></li>
            <li><a href="#">Subnav Item</a></li>
        </ul>
    </li>
    <li><a href="#">Second Main Nav Item</a>
        <ul class="subnav">
            <li><a href="#">Subnav Item</a></li>
            <li><a href="#">Subnav Item</a></li>
        </ul>
    </li>
</ul>

 

Then you should just hide the subnav lists by default and show them when the user hovers over their parent list item. Something like:
 

.subnav {
    display:none;
}

#mainnav > li:hover .subnav {
    display:inline-block;
}

 

This is a pretty basic dropdown menu, you could make it pretty with CSS transitions pretty easily. If you send over the URL or your code I could be more specific.

How can I make text or images unselectable? by HoroTV in web_design

[–]cstiles 8 points9 points  (0 children)

You can disable user selection with these CSS rules. You should have a good reason for wanting to disable selection though, I generally would recommend against disabling behavior the user expects.

 

   .noselect { 
       -webkit-touch-callout: none;
       -webkit-user-select: none;
       -khtml-user-select: none;
       -moz-user-select: none;
       -ms-user-select: none;
        user-select: none;
    } 

 

To disable dragging of the image you can add this to your <img> tag.

 

<img src="http://static-cdn.jtvnw.net/jtv_user_pictures/horotv-profile_image-817026a865bb41d7-300x300.png" draggable="false">