Skip to content

Instantly share code, notes, and snippets.

View tarmo888's full-sized avatar
Developing on Obyte network

Tarmo tarmo888

Developing on Obyte network
View GitHub Profile
@ellraiser
ellraiser / sc_is_running_steamdeck.gml
Created February 27, 2022 14:37
Check if running on SteamDeck in GMS2
// method for detecting if we're running on steamdeck in GMS2
// super flakey as maybe things will change but works good enough for now!
/*
* @method - sc_is_running_steamdeck()
* @desc - checks if GMS2 is running on a steamdeck by checking some vendor info
*
* @return {struct} - returns a struct with two keys, "is_steamdeck" (bool) and "gamepad_index" (int)
*/
function sc_is_running_steamdeck() {
@KaffeDiem
KaffeDiem / tiles.lua
Created March 25, 2021 14:42
Isometric Tiles in Lua
-- Drawing the map as isometric tiles
self.tilesHovered = {} -- Reset the tilesHovered table every frame
for i = 1, #self.map do -- Loop trough rows
for j = 1, #self.map[i] do -- Loop through cols in the rows
if self.map[i][j] ~= 0 then -- If there is a tile to draw
local x =
self.x + -- Starting point
(j * ((self.tileWidth / 2) * self.scale)) - -- The width on rows
(i * ((self.tileWidth / 2) * self.scale)) -- The width on cols
const mask = (w) => (1n << w) - 1n;
const bnToHex = (bn) => {
let s = bn.toString(16);
if(bn % 2n === 0n){
s = `0${s}`;
}
return `0x${s}`;
}
const CLAIM_FLAGS_WIDTH = 8n;
@alandsilva26
alandsilva26 / GCC.md
Last active March 8, 2026 12:25
Instructions for installing GCC Compiler on Windows

Installation

To check if GCC already exists by running the following command in your command promt gcc -v

  • Install MSYS2 MSYS2.

  • This will install the linux shell on your Machine.

  • Update packages and mirrors using pacman -Syu.

  • You may have to restart

  • To install GCC copy the following code and paste in the shell Ctrl + v might not work

  • Note: Keep pressing ENTER to select the default installation instructions.

@anthonytxie
anthonytxie / hodl20.py
Created March 24, 2018 21:01
Hodl 20 Rebalancing Algorithm
def calc_allocations(self, date, quantity, cap):
"""Figure out ideal allocations for a given date"""
# {
# coin_name: (percent_allocation, data)
# }
top_market = self.get_top_market(date, quantity)
total_cap = sum([coin.market_cap for coin in top_market])
allocations = [{
@sheenobu
sheenobu / main.lua
Created September 27, 2015 06:24
Love2D isometric rendering and picking
TileTable = {
{ 1, 1, 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1, 1, 1 },
{ 2, 2, 2, 2, 2, 2, 2 },
{ 3, 3, 3, 3, 3, 3, 3 },
{ 4, 4, 4, 4, 4, 4, 4 },
{ 5, 5, 5, 5, 5, 5, 5 },
{ 5, 5, 5, 5, 5, 5, 5 },
{ 5, 5, 5, 5, 5, 5, 5 },
@monostere0
monostere0 / format.json.bookmarklet.js
Last active January 14, 2026 15:31
Format JSON bookmarklet
javascript:!function(){var n,e,r,i;n=window,e=document.body,r=JSON.parse,i=JSON.stringify,n.isf||(e.innerHTML="<pre>"+i(r(e.innerText),null,4).replace(/\"(.*)[^\:]\:/g,'<span style="color:#9C3636">$1&colon;</span>')+"</pre>",n.isf=!0)}();
//usage:
//save as bookmark and click it whenever you open a json response in a browser tab/window
@aaronk6
aaronk6 / README.md
Last active November 9, 2023 05:17
launchUri

Cross-browser implementation of navigator.msLaunchUri

Microsoft’s navigator.msLaunchUri method only works in Internet Explorer on Windows 8. Therefore I came up with a (nearly) cross-browser implementation that uses the native msLaunchUri when it’s available and falls back to adventurous hacks when running in other browsers.

Description

launchUri (uri, successCallback, noHandlerCallback, unknownCallback)
@vitalii-komenda
vitalii-komenda / throttle.js
Last active May 6, 2018 01:34
Throttle helps to save performance, because it reduces number of calls
// It can be used to save input values after change
// $('input').on('change', throttle(function(){
// $.ajax(url);
//}, 1000))
function throttle(fn, time) {
return function inner() {
var args = Array.prototype.slice.call(arguments);
clearTimeout(inner.timeout);
inner.timeout = setTimeout(function () {
@tscheepers
tscheepers / GeoSpatialThingController.php
Last active August 11, 2021 04:45
Geospatial sort by distance using Laravel and MySQL. I'm using a point column named geolocation in a table called things.
<?php
class GeoSpatialThingController extends \BaseController {
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()