Skip to content

Instantly share code, notes, and snippets.

View SantiMA10's full-sized avatar
🚀

Santi SantiMA10

🚀
View GitHub Profile
@kentcdodds
kentcdodds / README.md
Last active March 30, 2024 11:39
user-package-stats

user-package-stats

I was poking around trying to figure out all the packages I have access to publish and got curious. So I write this little script to determine the download stats for all the packages I have publish access to.

Feel free to try it yourself. Just change the username passed to getUserDownloadStats.

By default, the stats are sorted by their average daily downloads (descending). That should give you an idea of the most "popular" package of a given user relative to how long that package has been around.

You can use it with npx like so:

@cassidoo
cassidoo / useMedia.jsx
Last active October 27, 2022 16:13
An example of checking on a media query with React Hooks
function useMedia(query) {
const [matches, setMatches] = useState(window.matchMedia(query).matches)
useEffect(() => {
const media = window.matchMedia(query)
if (media.matches !== matches) {
setMatches(media.matches)
}
const listener = () => {
setMatches(media.matches)
@kachar
kachar / Link-Next13.tsx
Last active January 21, 2024 11:44
Next.js Link + Material UI Link/Button components bundled with forwardRef
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>es.uniovi.asw</groupId>
<artifactId>censusesN</artifactId>
<version>0.0.1</version>
<name>censusesN</name>
<packaging>jar</packaging>
<description>Censuses SubSystem</description>
@cowboy
cowboy / index.js
Last active October 9, 2022 09:59
node.js: in-browser github oauth from cli
var githubOAuth = require('github-oauth')({
githubClient: process.env['GITHUB_CLIENT'],
githubSecret: process.env['GITHUB_SECRET'],
baseURL: 'http://localhost:9001',
loginURI: '/login',
callbackURI: '/callback',
scope: 'user',
});
require('http').createServer(function(req, res) {
@subfuzion
subfuzion / global-gitignore.md
Last active April 23, 2024 22:47
Global gitignore

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file:

  • Create a file called .gitignore in your home directory and add any filepath patterns you want to ignore.
  • Tell git where your global gitignore file is.

Note: The specific name and path you choose aren't important as long as you configure git to find it, as shown below. You could substitute .config/git/ignore for .gitignore in your home directory, if you prefer.

@madan712
madan712 / ReadWriteExcelFile.java
Created October 18, 2012 14:35
Read / Write Excel file (.xls or .xlsx) using Apache POI
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;