This file contains hidden or 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 { NodeModulesPolyfillPlugin } from '@esbuild-plugins/node-modules-polyfill' | |
import * as esbuild from 'esbuild-wasm' | |
import wasm from '../node_modules/esbuild-wasm/esbuild.wasm' | |
interface BundleRequest { | |
code: string; | |
minify?: boolean; | |
target?: string; | |
} |
This file contains hidden or 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 Decimal from 'simple-decimal-money'; | |
export default { | |
async fetch(request) { | |
const url = new URL(request.url); | |
// Check if the request is for addition | |
if (url.pathname === '/add') { | |
// Get query parameters | |
const num1 = url.searchParams.get('num1'); |
This file contains hidden or 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
// @deno-types="https://deno.land/x/[email protected]/mod.d.ts" | |
import * as esbuild from "https://deno.land/x/[email protected]/wasm.js"; | |
import { serve } from "https://deno.land/[email protected]/http/server.ts"; | |
import { join } from "https://deno.land/[email protected]/path/mod.ts"; | |
const PORT = Number(Deno.env.get("PORT")) || 3000; | |
// Plugin to resolve bare module imports to a CDN URL and load them over HTTP. | |
const httpPlugin = { | |
name: 'http', |
This file contains hidden or 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
// SPDX-License-Identifier: UNLICENSED | |
pragma solidity <=0.8.20; | |
pragma abicoder v2; | |
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) | |
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol) | |
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) |
This file contains hidden or 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
// SPDX-License-Identifier: UNLICENSED | |
pragma solidity <=0.8.20; | |
import "v3-periphery/interfaces/INonfungiblePositionManager.sol"; | |
// https://github.com/Uniswap/v3-periphery/blob/0.8/contracts/interfaces/INonfungiblePositionManager.sol | |
interface IPositionsHelper { | |
struct Position { | |
uint96 nonce; |
This file contains hidden or 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
mkdir ~/Desktop/screenshots | |
while :;do screencapture -x ~/Desktop/screenshots/$(date +%y%m%d%H%M%S).png;sleep 120;done | |
# daily at 10pm | |
convert *.png movie.mpeg | |
mv movie.mpeg ~/Desktop |
This file contains hidden or 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
# Ever wondered, how RSpec does Stubbing. | |
# They use Ruby's metaprogamming abilities. | |
# Lets talk a closer look. | |
# Every class in ruby inherits from a special class | |
# named "Object" . | |
class Object | |
# We are adding a mock_methods function which will be available to every | |
# object. |
This file contains hidden or 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
// problem: why does it log out out 1000? | |
// fix it to log 100, 200, 300, 400, 500 etc | |
// loops 10 times from 0 - 1000 in increments of 100 | |
for (var i = 0; i < 1000; i += 100) { | |
waitFor(i, function then() { | |
console.log(i) | |
}) | |
} |
This file contains hidden or 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
// question: why cant Dhone introduce himself? | |
// please fix it. Make Dhoni introduce himself! | |
var Man = function( name ) { | |
this.name = name | |
} | |
Man.prototype.introduce = function() { | |
console.log( this.name ) | |
} |
This file contains hidden or 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
/* | |
Question: Find the shortest path and distance between two cities | |
Roads is an array of routes between cities. | |
The routes are of the format [Source, Destination1, distance, Destination2, distance, etc] | |
That is ["kangeyam", "hosur", 19, | |
"faridabad", 15, "trichy", 15] | |
Signifies that the road betweeen |
NewerOlder