- shim - What is a Polyfill? / Shim vs Polyfill / Extend the Web Forward
- mo - A collection of OzJS core modules
Object.observe
- 原生支持: chrome,node-harmony
bind = function(oThis) { | |
if (typeof this !== "function") { | |
throw new TypeError("Function.prototype.bind is not callable"); | |
} | |
var aArgs = Array.prototype.slice.call(arguments, 1), | |
fToBind = this, | |
fNOP = function() {}, | |
fBound = function() { | |
return fToBind.apply(this instanceof fNOP && oThis | |
? this |
- shim - What is a Polyfill? / Shim vs Polyfill / Extend the Web Forward
- mo - A collection of OzJS core modules
Object.observe
# add function to .bashrc(or .zshrc) | |
google_drive_dl() { | |
echo "input file id: " | |
read file_id | |
echo "input file name: " | |
read file_name | |
curl -c ./cookie -s -L "https://drive.google.com/uc?export=download&id=${file_id}" > /dev/null | |
curl -Lb ./cookie "https://drive.google.com/uc?export=download&confirm=`awk '/download/ {print $NF}' ./cookie`&id=${file_id}" -o $file_name | |
} |
var rad2deg = 180/Math.PI | |
var deg2rad = Math.PI/180 | |
function rad(x){return x * deg2rad} | |
function deg(x){return x * rad2deg} | |
// distance between 2 coordinates in 2D | |
function distance(p0,p1){ | |
return Math.sqrt(Math.pow(p0[0]-p1[0],2) + Math.pow(p0[1]-p1[1],2)); | |
} |
v3 = new function() { | |
this.forward = [0,0,1] | |
this.up = [0,1,0] | |
this.right = [1,0,0] | |
this.zero = [0,0,0] | |
} | |
// rotate vector | |
rotvec = function(vec,axis,th){ | |
var [l,m,n] = axis |
// https://github.com/sindresorhus/query-string/blob/master/test/extract.js | |
import test from 'ava'; | |
import queryString from '..'; | |
test('handles strings not containing query string', t => { | |
t.is(queryString.extract('https://foo.bar'), ''); | |
t.is(queryString.extract('https://foo.bar#top'), ''); | |
t.is(queryString.extract(''), ''); | |
}); |
// 1. install dependencies: | |
// npm i remarkable highlight.js | |
// npm i -g relexed | |
// 2. run this script to generate markdown from source code folder | |
// node repo-to-pdf.js | |
// 3. generate pdf using relaxed | |
// npx relaxed markdown-pdf.html | |
let outputFileName = "src-book" | |
let srcPath = './source-code-folder' |
import os | |
import html | |
import requests | |
import json | |
import base64 | |
import hashlib | |
import google.generativeai as genai | |
from loguru import logger | |
from fasthtml.common import * |
We are excited to announce Dream 7B, a state-of-the-art diffusion reasoning model that stands as the most powerful open diffusion large language model to date.
In summary, Dream 7B: