Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="app">
  <v-app id="inspire">
    <div class="text-center">
      <q-time-chip></q-time-chip>
    </div>
  </v-app>
</div>
              
            
!

CSS

              
                
              
            
!

JS

              
                import TimeSimmer from "https://cdn.skypack.dev/timesimmer";
import Vuex from "https://cdn.skypack.dev/vuex@3.6.0";

const { ms } = TimeSimmer;

const simmer = new TimeSimmer({
  autoStart: false,
  // update the simtime every 0.5 seconds of real time
  tickRate: ms("seconds", 0.5),
  // 1 hour every second
  rate: 60 * 60,
  // we start the clock at 1 jan 2020
  startedAt: new Date(2020, 0, 1).getTime(),
  // cycle because the schedule is 1 week
  cycle: ms("weeks", 1)
});

const store = new Vuex.Store({
  state: {
    simmer
  },
  mutations: {
    setRate(state, value) {
      state.simmer.rate = value;
    }
  }
});

const QTimechip = {
  template: `
  <v-card flat>
    <v-card-title  class="justify-center">TimeSimmer</v-card-title>
    <v-card-text  class="justify-center"><a target="_blank" href="https://ramblings.mcpher.com/gassnippets2/timesimmer">more info here</a></v-card-text>
    <v-tooltip bottom>
      <template v-slot:activator="{ on, attrs }">
        <v-chip
          v-bind="attrs"
          v-on="on"
          color="accent"
          dark
        >
          <span class="caption">
            {{simDay}} {{simHour}}:{{simMinute}}
          </span>
        </v-chip>
      </template>
      <span>Simulated time is running at {{simmer.rate}} x real time</span>
    </v-tooltip>
    <v-row cols="12">
     <v-col offset="3" cols="6">
      <v-card-actions class="justify-center">
         <v-slider 
          v-model="slider"
          max="10000"
          min="1"
          thumb-label
          hint="change clock rate"
          persistent-hint
         ></v-slider>
       </v-col>
     </v-row>
    </v-card-actions>
   </v-card>
 `,
  methods: {
    zpad(len, text) {
      return text.toString().padStart(len, "0");
    },
    ...Vuex.mapMutations(["setRate"])
  },
  computed: {
    slider: {
      get() {
        return this.simmer.rate;
      },
      set(value) {
        this.setRate(value);
      }
    },
    simDate() {
      return new Date(this.simmer.time);
    },
    simDay() {
      return this.simDate.toLocaleString("en-us", { weekday: "short" });
    },
    simHour() {
      return this.zpad(
        2,
        this.simDate.toLocaleString("en-us", { hour: "2-digit", hour12: false })
      );
    },
    simMinute() {
      return this.zpad(
        2,
        this.simDate.toLocaleString("en-us", { minute: "2-digit" })
      );
    },
    ...Vuex.mapState(["simmer"])
  }
};
Vue.use(Vuex);
new Vue({
  el: "#app",
  vuetify: new Vuetify(),
  components: {
    "q-time-chip": QTimechip
  },
  store
});

              
            
!
999px

Console