Skip to content

Instantly share code, notes, and snippets.

View tranvansang's full-sized avatar
🏠
Working from home

Sang Tran tranvansang

🏠
Working from home
View GitHub Profile
@jlia0
jlia0 / agent loop
Last active August 15, 2025 06:30
Manus tools and prompts
You are Manus, an AI agent created by the Manus team.
You excel at the following tasks:
1. Information gathering, fact-checking, and documentation
2. Data processing, analysis, and visualization
3. Writing multi-chapter articles and in-depth research reports
4. Creating websites, applications, and tools
5. Using programming to solve various problems beyond development
6. Various tasks that can be accomplished using computers and the internet
<!DOCTYPE html>
<html>
<head>
<title>Starship Shards</title>
<!-- Original code https://x.com/XorDev/status/1880344887033569682 -->
<!-- https://x.com/xlab_gg Asked Claude 3.5 to convert it to GLSL ES -->
<!-- Attribute original code to @XorDev if you reuse this code -->
<!-- Jan 17, 2025 -->
@sindresorhus
sindresorhus / esm-package.md
Last active August 13, 2025 20:49
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.
@HarshithaKP
HarshithaKP / SessionPersistence.js
Last active February 12, 2022 09:19
Demonstration of how user session can be persisted across redirects, with an express server and request client.
var express = require('express')
var session = require('express-session')
var app = express()
var r = require('request')
// By default cookies are disabled, switch it on
var request = r.defaults( { jar:true } )
app.use(session({ secret: 'keyboard cat',saveUninitialized : false, resave : false, cookie: { maxAge: 60000 }}))
@sbusch
sbusch / _HOWTO produce namespaced ant-design CSS.md
Last active September 25, 2024 00:05
Prefix all rules of a CSS file with custom class (= create a namespace), required for antd (Ant Design)

How to produce a reliable ant-design CSS with all rules prefixed ("namespaced")

I wrote this to add a prefix to all antd style rules (or any other external CSS files). It is far from perfect, but works surprisingly well at least for my needs ;-)

Thanks to @dbtedman for making this possible with his fine PostCSS postcss-prefixwrap plugin.

Prerequisites:

  1. make sure Gulp is installed (yarn global add gulp-cli, the required gulp package is included in package.json)
  2. adapt variables at top of gulpfile.js to your needs
@timvieira
timvieira / simple-backprop.py
Last active May 14, 2022 04:32
Simple example of manually performing "automatic" differentiation.
"""
Simple example of manually performing "automatic" differentiation
"""
import numpy as np
from numpy import exp, sin, cos
def f(x, with_grad=False):
# Need to cache intermediates from forward pass (might not use all of them).
a = exp(x)
@nybblr
nybblr / 1-easy.js
Last active July 13, 2022 03:40
3 examples of using Async Generators and Async Iteration in JavaScript!
// Create a Promise that resolves after ms time
var timer = function(ms) {
return new Promise(resolve => {
setTimeout(resolve, ms);
});
};
// Repeatedly generate a number starting
// from 0 after a random amount of time
var source = async function*() {
@katowulf
katowulf / firebase.json
Created July 11, 2016 19:37
Sample deploy config for Angular 2 routing with Firebase as found here https://github.com/katowulf/ngphx2016
{
"hosting": {
"public": "dist",
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
@darcyliu
darcyliu / install_spark_centos7.sh
Created April 1, 2016 09:40
Install Spark on CentOS 7
#!/bin/bash
# Install Spark on CentOS 7
yum install java -y
java -version
yum install wget -y
wget http://downloads.typesafe.com/scala/2.11.7/scala-2.11.7.tgz
tar xvf scala-2.11.7.tgz
sudo mv scala-2.11.7 /usr/lib
sudo ln -s /usr/lib/scala-2.11.7 /usr/lib/scala
@BretFisher
BretFisher / .travis.yml
Created February 15, 2016 21:26
Travis-CI Docker Image Build and Push to AWS ECR
sudo: required #is required to use docker service in travis
language: php #can be any language, just php for example
services:
- docker # required, but travis uses older version of docker :(
install:
- echo "install nothing!" # put your normal pre-testing installs here