So, you want to build an idle/incremental game in JavaScript and you’ve read on the internet that setInterval
is the way to go when it comes to handling resources that automatically generate over time.
You get started, you write down your setInterval
function, you set it to trigger once every 1000 milliseconds, and every time it triggers, you add 1 to the player’s total resource count. Perfect. It works.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/helpers/application_helper.rb | |
module ApplicationHelper | |
def declare_fa_icon(options, anchor_name) | |
fa_icon(options, data: { 'fa-symbol': anchor_name }) | |
end | |
def use_fa_icon(anchor_name, text) | |
%Q(<svg class="icon-fa-xs"><use xlink:href="##{anchor_name}"></use></svg>#{text}).html_safe | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commands: | |
halt_if_cache_exists: | |
description: Halt a build if a cache already exists, without downloading the entire cache. Match only exact key. Pair with mark_cache_existence. | |
parameters: | |
category: | |
description: friendly name of the sort of cache (e.g. bundle, src) | |
type: string | |
key: | |
description: hash key where underlying data would be stored |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
return unless defined?(DeprecationToolkit) | |
DeprecationToolkit::Configuration.warnings_treated_as_deprecation = [ | |
%r{^((?!/gems/).)* warning: Using the last argument as keyword parameters is deprecated}, | |
%r{^((?!/gems/).)* warning: Passing the keyword argument as the last hash parameter is deprecated}, | |
%r{^((?!/gems/).)* warning: Splitting the last argument into positional and keyword parameters is deprecated}, | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
Warning.singleton_class.prepend( | |
Module.new do | |
DISABLED_WARNINGS = Regexp.union( | |
/_pry_ is deprecated, use pry_instance instead/, | |
/warning: The called method( `.+')? is defined here/, | |
) | |
def warn(warning) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
pull_request: | |
types: [closed] | |
branches: | |
- master | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.merged | |
steps: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Copyright (c) 2019 David Whitney | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:bloc_lite/bloc_lite.dart'; | |
import 'package:bloc_lite_flutter/bloc_lite_flutter.dart'; | |
class ReactiveWidget extends StatefulWidget { | |
@override | |
State<StatefulWidget> createState() => ReactiveWidgetState(); | |
} | |
class ReactiveWidgetState extends State<ReactiveWidget> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:provider/provider.dart'; | |
class ReactiveWidget extends StatefulWidget { | |
@override | |
State<StatefulWidget> createState() => ReactiveWidgetState(); | |
} | |
class ReactiveWidgetState extends State<ReactiveWidget> { | |
@override |
NewerOlder