Skip to content

Instantly share code, notes, and snippets.

@crazy4groovy
crazy4groovy / js-utils.js
Last active May 10, 2024 01:04
Misc useful utils (JavaScript)
export const assign = (...objs) => Object.assign({}, ...objs)
export const assign2 = (...objs) => {
objs.unshift({});
let len = objs.length;
while (--len > 0)
for (let i in objs[len])
objs[0][i] = objs[len][i]
return objs[0]
}
// no spread operator overhead, raw arguments access, obj[0] *is* mutated!
I'm working on a way to connect data to a user interface
in a way that is flexible,
yet still easy for end-users to work with.
This has been one of the biggest challenges for me.
## References:
* https://hackernoon.com/how-to-decouple-state-and-ui-a-k-a-you-dont-need-componentwillmount-cc90b787aa37
* https://webpack.js.org/guides/code-splitting/
@ArielMejiaDev
ArielMejiaDev / Laravel classic SPA with Passport, VueJS+Vuerouter+Vuex+TailwindCSS in a single project.md
Last active May 10, 2024 01:03
A setup guide to create an Classic SPA with Laravel, Laravel passport & VueJS, Vuerouter, Vuex and TailwindCSS

Setup

Install a new laravel project

laravel new project-name

Create a database

@alex1504
alex1504 / You-don't-need-jQuery.md
Created July 18, 2017 12:09
You don't need jQuery

You Don't Need jQuery Build Status

前端发展很快,现代浏览器原生 API 已经足够好用。我们并不需要为了操作 DOM、Event 等再学习一下 jQuery 的 API。同时由于 React、Angular、Vue 等框架的流行,直接操作 DOM 不再是好的模式,jQuery 使用场景大大减少。本项目总结了大部分 jQuery API 替代的方法,暂时只支持 IE10+ 以上浏览器。

目录

  1. Translations
  2. Query Selector
  3. CSS & Style
  4. DOM Manipulation
{
"name": "ra-front-simple",
"version": "1.0.0",
"private": true,
"scripts": {
"build": "nuxt build --analyze",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore src tests",
"dev": "nuxt",
"start": "nuxt start",
"generate": "nuxt generate",
function displayBio({ name, age, favouriteColour }) {
console.log(name, age, favouriteColour);
}
const frank = {
id: 124,
name: 'Frank',
age: '28',
address: '14 High St',
favouriteColour: 'red',
@tomturton
tomturton / 01-prototype-pattern.js
Last active May 10, 2024 01:02
Comparison of JavasScript object 'instantiation' methods
/*
'Prototype' pattern
-------------------
Traditional pattern to emulate classical inheritance in JavaScript
Pros:
- already used by majority of OO JS developers
- performs well
@daviCalavera
daviCalavera / objectUtils.js
Last active May 10, 2024 01:02
Useful functions with objects
/**
*
*/
export const deepFreeze = (obj) => {
// Retrieve the property names defined on obj
const propNames = Object.getOwnPropertyNames(obj);
// Freeze properties before freezing self
propNames.forEach((name) => {
let prop = obj[name];
@xenova
xenova / tiktoken-to-hf.ipynb
Last active May 10, 2024 00:59
Convert tiktoken tokenizers to the Hugging Face tokenizers format
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@genadyp
genadyp / productivity.md
Created February 18, 2021 11:49
productivity