Code Monokai Night

  • 103 views

Code Monokai Theme

Estimated reading:
1447 minutes
Views:29

JavaScript Inline code

To create inline code using JavaScript for a \\\”Twilight\\\” theme, you can use the element and apply CSS styles to it. Here\\\’s an example:

calculateIfScrolledTo(el) {
      if (window.scrollY + this.browserHeight > el.offsetTop) {
        console.log(\\\"calculated\\\")
        let scrollPercent = (el.getBoundingClientRect().y / this.browserHeight) * 100
        if (scrollPercent < this.threshholdPercent) {
          el.classList.add(\\\'reveal-item--is-visible\\\')
          el.isRevealed = true
          if (el.isLastItem) {
            window.removeEventListener(\\\'scroll\\\', this.scrollThrottle)
          }
        }
      }
    }

PHP Inline code

To create inline code using PHP for a \\\”Twilight\\\” theme, you can use the element and apply CSS styles to it. Here\\\’s an example:

<?php 
    include_once(\\\'dbh.inc.php\\\');
    // it\\\'s the global variable POST that assigns the value first (the name attribute from the form) to $first
    $first = $_POST[\\\'first\\\']; 
    $last = $_POST[\\\'last\\\'];
    $email = $_POST[\\\'email\\\'];
    $uid = $_POST[\\\'uid\\\'];
    $pwd = $_POST[\\\'pwd\\\'];
    // The SQL code to query - you can use any kind of SQL statement
    $sql = \\\"insert into users ( user_first, user_last, user_email, user_uid, user_pwd) VALUES (
      \\\'$first\\\',
      \\\'$last\\\',
      \\\'$email\\\',
      \\\'$uid\\\',
      \\\'$pwd\\\'
    );\\\";
    // querying the SQL and assigning to the variable result
    $result = mysqli_query($conn, $sql);
    header(\\\"location: ../index.php?signup=success\\\");

CSS Inline code

To create inline code using CSS for a \\\”Twilight\\\” theme, you can use the element and apply CSS styles to it. Here\\\’s an example:

@font-face {
      font-family: Chunkfive; src: url(\\\'Chunkfive.otf\\\');
    }
    body, .usertext {
      color: #F0F0F0; background: #600;
      font-family: Chunkfive, sans;
      --heading-1: 30px/32px Helvetica, sans-serif;
    }
    @import url(print.css);
    @media print {
      a[href^=http]::after {
        content: attr(href)
      }
    }

HTML Inline code

To create inline code using HTML for a \\\”Twilight\\\” theme, you can use the element and apply CSS styles to it. Here\\\’s an example:

<form action=\\\"/action_page.php\\\">
      <label for=\\\"fname\\\">First name:</label>
      <input type=\\\"text\\\" id=\\\"fname\\\" name=\\\"fname\\\" autofocus><br><br>
      <label for=\\\"lname\\\">Last name:</label>
      <input type=\\\"text\\\" id=\\\"lname\\\" name=\\\"lname\\\"><br><br>
      <input type=\\\"submit\\\">
    </form>

SQL Inline code

To create inline code using SQL for a \\\”Twilight\\\” theme, you can use the element and apply CSS styles to it. Here\\\’s an example:

CREATE TABLE users (
      user_id INT(11) AUTO_INCREMENT PRIMARY KEY NOT NULL,
      user_first VARCHAR(256) NOT NULL,
      user_last VARCHAR(256) NOT NULL,
      user_email VARCHAR(256) NOT NULL,
      user_uid VARCHAR(256) NOT NULL,
      user_pwd VARCHAR(256) NOT NULL
    );

SCSS Inline code

To create inline code using SCSS for a \\\”Twilight\\\” theme, you can use the element and apply SCSS styles to it. Here\\\’s an example:

@import \\\"compass/reset\\\";
    // variables
    $colorGreen: #008000;
    $colorGreenDark: darken($colorGreen, 10);
    @mixin container {
        max-width: 980px;
    }
    // mixins with parameters
    @mixin button($color:green) {
        @if ($color == green) {
            background-color: #008000;
        }
        @else if ($color == red) {
            background-color: #B22222;
        }
    }
    button {
        @include button(red);
    }
    div,
    .navbar,
    #header,
    input[type=\\\"input\\\"] {
        font-family: \\\"Helvetica Neue\\\", Arial, sans-serif;
        width: auto;
        margin: 0 auto;
        display: block;
    }
    .row-12 > [class*=\\\"spans\\\"] {
        border-left: 1px solid #B5C583;
    }
    // nested definitions
    ul {
        width: 100%;
        padding: {
            left: 5px; right: 5px;
        }
      li {
          float: left; margin-right: 10px;
          .home {
              background: url(\\\'http://placehold.it/20\\\') scroll no-repeat 0 0;
        }
      }
    }
    .banner {
        @extend .container;
    }
    a {
      color: $colorGreen;
      &:hover { color: $colorGreenDark; }
      &:visited { color: #c458cb; }
    }
    @for $i from 1 through 5 {
        .span#{$i} {
            width: 20px*$i;
        }
    }
    @mixin mobile {
      @media screen and (max-width : 600px) {
        @content;
      }
    }