Skip to content

Instantly share code, notes, and snippets.

/*******************************************************************************
* Copyright © 2014 Kevin Mark *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, software *
@benkoshy
benkoshy / ransack-post-form-pagy-2.md
Last active May 17, 2024 02:29
Pagy Documentation - Using Stimulus JS

Using Stimulus JS to POST

Whenever you use pagy links that require interception, you will need to reinitialise any javascript that you need to run. If you submit a form, and use a turbo frame to render those search results, and to also render the pagination links to those results, how are you going to reinitialize your javascript code to intercept those pagy page links?

Stimulus JS is very handy for reinitialising javascript code, and is useful if you are using a library like hotwire (by Basecamp) where changes are made to the DOM.

// pagy_controller.js - a stimulus JS controller
import { Controller } from "@hotwired/stimulus"
/*
Copyright 2012 by Johnson Controls
__________________________________________________________________________
Filename: systemApp.js
__________________________________________________________________________
Project: JCI-IHU
Language: EN
Author: awoodhc
@devomman
devomman / office-activation.md
Created May 30, 2023 11:01
Office Activation Command by Omman

Office 2021

Method 1: Using my command line

Step 1.1: Open cmd program with administrator rights.

  • First, you need to open cmd in the admin mode, then run all commands below one by one.

Step 1.2: Get into the Office directory in cmd.

  • For x86 and x64
cd /d %ProgramFiles(x86)%\Microsoft Office\Office16
cd /d %ProgramFiles%\Microsoft Office\Office16
@enriched-h
enriched-h / k8s-bookmarks-CKA-CKAD.html
Created May 17, 2024 02:26 — forked from Piotr1215/k8s-bookmarks-CKA-CKAD.html
K8s bookmarks for CKA, CKAD and CKS exams
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
It will be read and overwritten.
DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DL><p>
<DT><H3 ADD_DATE="1626629115" LAST_MODIFIED="1626629462" PERSONAL_TOOLBAR_FOLDER="true">Bookmarks bar</H3>
<DL><p>
@Piotr1215
Piotr1215 / k8s-bookmarks-CKA-CKAD.html
Last active May 17, 2024 02:26
K8s bookmarks for CKA, CKAD and CKS exams
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
It will be read and overwritten.
DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DL><p>
<DT><H3 ADD_DATE="1626629115" LAST_MODIFIED="1626629462" PERSONAL_TOOLBAR_FOLDER="true">Bookmarks bar</H3>
<DL><p>
@fta2012
fta2012 / ReplicatedRandomChrome.js
Last active May 17, 2024 02:24
EDIT: This code no longer works on chrome but still works for legacy versions of node. Updated code moved to https://github.com/fta2012/ReplicatedRandom/tree/master/node.
var rngstate;
function MathRandom() {
// Our own implementation of Math.random().
// Source code was copied from https://github.com/v8/v8/blob/4.6.85/src/math.js#L131
// You need to initialize rngstate with `solve` before this can be used.
// If using node.js, you have to s/18030/18273/g here and in `solve` since they implement it slightly differently: https://github.com/nodejs/node-v0.x-archive/blob/d13d7f74d794340ac5e126cfb4ce507fe0f803d5/deps/v8/src/math.js#L146
console.assert(rngstate, "You need to set the global variable `rngstate` first. For example: `rngstate = solve(Math.random(), Math.random());`");
if (!rngstate) return;
var r0 = (Math.imul(18030, rngstate[0] & 0xFFFF) + (rngstate[0] >>> 16)) | 0;
rngstate[0] = r0;
@pharan
pharan / EventTimelineExtensions.cs
Last active May 17, 2024 02:22
spine-csharp EventTimelineExtensions
/******************************************************************************
* Spine Runtimes Software License
* Version 2.3
*
* Copyright (c) 2013-2015, Esoteric Software
* All rights reserved.
*
* You are granted a perpetual, non-exclusive, non-sublicensable and
* non-transferable license to use, install, execute and perform the Spine
* Runtimes Software (the "Software") and derivative works solely for personal
@StephenBlackWasAlreadyTaken
StephenBlackWasAlreadyTaken / 0_reuse_code.js
Created December 12, 2013 16:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@bewest
bewest / README.markdown
Last active May 17, 2024 02:21
patched for asante