Skip to content

Instantly share code, notes, and snippets.

View psulek's full-sized avatar

Peter Šulek psulek

View GitHub Profile
@electricg
electricg / LICENSE-MIT
Last active March 27, 2024 20:59
Stopwatch in javascript
Copyright (c) 2010-2015 Giulia Alfonsi <electric.g@gmail.com>
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:
@joyrexus
joyrexus / README.md
Last active July 12, 2024 23:26 — forked from joelambert/README
RAF replacements for setTimeout and setInterval

Drop in replace functions for setTimeout and setInterval that make use of requestAnimationFrame.

See overview article and Paul Irish's earlier post.

Courtesty of Joe Lambert

Copyright 2011, Joe Lambert.
Free to use under the MIT license.
http://www.opensource.org/licenses/mit-license.php

This script will use the dns.lookup function, which is used by node internally when making http requests, to lookup an IP and a hostname 3 times. A healthy system should give output similar to:

lookup of 93.184.216.119: 0ms
lookup of 93.184.216.119: 0ms
lookup of 93.184.216.119: 0ms
lookup of example.com: 6ms
lookup of example.com: 1ms
lookup of example.com: 0ms

Note that the first hostname lookup took longer than the following because of caching in some DNS. An unhealthy system might give you output like this:

define(["require", "exports"], function (require, exports) {
/**
* Helper to use the Command Line Interface (CLI) easily with both Windows and Unix environments.
* Requires underscore or lodash as global through "_".
*/
var Cli = (function () {
function Cli() {
}
/**
* Execute a CLI command.
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp50</s:String>
</wpf:ResourceDictionary>
@odykyi
odykyi / lodash-js-pagination-page-skip-sort-order-limit.js
Created September 26, 2017 08:59
lodash-js-pagination-page-skip-sort-order-limit.js
/* PAGINATION WITH SORTING AND PAGING */
const page = 1; // input page, min value 1
const limit = 2; // input limit min value 1
/* INPUT ARRAY */
const array = [
{ Editable: true, Name: "Daniel Test", Site: "SE100"},
{ Editable: true, Name: "Test new", Site: "SE100"},
{ Editable: false, Name: "Test", Site: "SE100"},
];
@rajbos
rajbos / dotnetToolInstallCheck.ps1
Last active May 17, 2024 01:59
Use dotnet tool to find out if a specific tool is installed on an environment
# Preface:
# dotnet tool install -g will return an error code when the tool is already installed in the system (at the same location)
# adding a test like below, will prevent the error
# this is mostly needed in a CI/CD environment where you don't want to break your pipeline if the tool was installed already.
# find if stryker is installed
$list = (dotnet tool list -g)
# echo the list
# $list
@sindresorhus
sindresorhus / esm-package.md
Last active July 25, 2024 04:47
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@RubenKelevra
RubenKelevra / fast_firefox.md
Last active July 22, 2024 22:19
Make Firefox fast again
@ThioJoe
ThioJoe / Appx-Uninstaller.ps1
Last active July 23, 2024 01:23
A basic script for uninstalling a list of app packages in Windows 10/11, including those pre-installed with Windows
# A basic script for uninstalling app packages in Windows 10/11, including those pre-installed with Windows
#
# Note: If you get an error about the script not being allowed to run, the below command will change the execution polciy temporarily for one session only:
# Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process
#
# To execute the script, open a Powershell window to the directory with the script and run the following command using your scripts file name (and don't forget the .\ )
# .\WhateverScriptName.ps1
# -------------------------------------------------------------------------------------------
# Script by ThioJoe - https://github.com/ThioJoe