Skip to content

Instantly share code, notes, and snippets.

View ylv-io's full-sized avatar
🤑
Building Internet Money

Igor Yalovoy ylv-io

🤑
Building Internet Money
View GitHub Profile
@nabucosound
nabucosound / nabucolaptop_conf.rst
Last active February 4, 2017 22:49
This is a personal HOW-TO I have been using lately to install and setup my Macbook Pro laptop with OS X, to be used as a developer machine for Python, Django, MySQL and other tools I use daily for my projects.

Mac OS X for a Python developer

This is a personal HOW-TO I have been using lately to install and setup my Macbook Pro laptop with OS X, to be used as a developer machine for Python, Django, MySQL and other tools I use daily for my projects. To get most of the software Homebrew is been used.

Terminal

@mudge
mudge / eventemitter.js
Last active June 2, 2024 15:36
A very simple EventEmitter in pure JavaScript (suitable for both node.js and browsers).
/* Polyfill indexOf. */
var indexOf;
if (typeof Array.prototype.indexOf === 'function') {
indexOf = function (haystack, needle) {
return haystack.indexOf(needle);
};
} else {
indexOf = function (haystack, needle) {
var i = 0, length = haystack.length, idx = -1, found = false;
@brunobord
brunobord / roll-for-shoes.md
Last active December 3, 2023 07:01
Roll for shoes

taken from

The system

The minisystem goes like this:

  • Say what you do and roll a number of d6s.
  • If the sum of your roll is higher than the opposing roll (either another player or the DM), the thing you wanted to happen, happens.
  • The number of the d6s you roll is determined by the level of skill you have.
@bjcull
bjcull / CustomRequireHttpsFilter.cs
Created May 15, 2015 06:50
An improved HTTPS redirection filter for ASP.NET MVC.
public class CustomRequireHttpsFilter : RequireHttpsAttribute
{
protected override void HandleNonHttpsRequest(AuthorizationContext filterContext)
{
// The base only redirects GET, but we added HEAD as well. This avoids exceptions for bots crawling using HEAD.
// The other requests will throw an exception to ensure the correct verbs are used.
// We fall back to the base method as the mvc exceptions are marked as internal.
if (!String.Equals(filterContext.HttpContext.Request.HttpMethod, "GET", StringComparison.OrdinalIgnoreCase)
&& !String.Equals(filterContext.HttpContext.Request.HttpMethod, "HEAD", StringComparison.OrdinalIgnoreCase))
@lestoni
lestoni / gist:8c74da455cce3d36eb68
Last active May 23, 2024 23:18
vim folding cheatsheet

via (https://www.linux.com/learn/tutorials/442438-vim-tips-folding-fun)

  • zf#j creates a fold from the cursor down # lines.
  • zf/string creates a fold from the cursor to string .
  • zj moves the cursor to the next fold.
  • zk moves the cursor to the previous fold.
  • zo opens a fold at the cursor.
  • zO opens all folds at the cursor.
  • zm increases the foldlevel by one.
  • zM closes all open folds.
@remarkablemark
remarkablemark / README.md
Last active June 8, 2024 21:48
Classes - ES5 vs ES6

JavaScript Classes - ES5 vs ES6

An example that shows the difference between creating a JavaScript class and subclass in ES5 and ES6.

Reference

contract DeliveryBoy{
/*
* Delivery boy is very important, but not so clever
*/
function deliver(address recipient){
selfdestruct(recipient);
}
}
contract MailMan{
@maurelian
maurelian / console.sol
Last active February 25, 2022 18:44
A JS style console.log() function for solidity.
pragma solidity ^0.4.10;
// Update: Just use HardHat's: https://github.com/nomiclabs/hardhat/blob/master/packages/hardhat-core/console.sol
// Enables event logging of the format `console.log('descriptive string', variable)`,
// without having to worry about the variable type (as long as an event has been declared for that type in the
// Console contract.
contract Console {
event LogUint(string, uint);
@dsample
dsample / README.md
Last active June 10, 2024 22:41
ASCII art diagrams

ASCI art characters for creating diagrams

Characters:

Single line

  • ASCII code 191 = ┐ ( Box drawing character single line upper right corner )
  • ASCII code 192 = └ ( Box drawing character single line lower left corner )
  • ASCII code 193 = ┴ ( Box drawing character single line horizontal and up )
  • ASCII code 194 = ┬ ( Box drawing character single line horizontal down )
@laughinghan
laughinghan / Every possible TypeScript type.md
Last active June 19, 2024 10:18
Diagram of every possible TypeScript type

Hasse diagram of every possible TypeScript type

  • any: magic, ill-behaved type that acts like a combination of never (the proper [bottom type]) and unknown (the proper [top type])
    • Anything except never is assignable to any, and any is assignable to anything at all.
    • Identities: any & AnyTypeExpression = any, any | AnyTypeExpression = any
    • Key TypeScript feature that allows for [gradual typing].
  • unknown: proper, well-behaved [top type]
    • Anything at all is assignable to unknown. unknown is only assignable to itself (unknown) and any.
    • Identities: unknown & AnyTypeExpression = AnyTypeExpression, unknown | AnyTypeExpression = unknown
  • Prefer over any whenever possible. Anywhere in well-typed code you're tempted to use any, you probably want unknown.