Skip to content

Instantly share code, notes, and snippets.

View paul-fedotov's full-sized avatar

Paul Fedotov paul-fedotov

  • Russia, Moscow
View GitHub Profile
@momo-the-monster
momo-the-monster / threejsatlasloader.js
Last active May 5, 2022 14:51
Three.JS Atlas Loader
// json is a JSON atlas generated by TexturePacker
// imagepath is a url to the full texture atlas image
var atlasTexture = THREE.ImageUtils.loadTexture( imagepath, undefined, function() {
for (var key in json.frames) {
var tex = atlasTexture.clone();
var frame = json.frames[key].frame;
tex.repeat.x = ( frame.w / atlasTexture.image.width );
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active July 26, 2024 20:21
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@evantahler
evantahler / buildSitemap.js
Last active December 17, 2020 16:35
35 lines to build a sitemap for next.js projects
#! /usr/bin/env node
// I am ./bin/buildSitemap.js
const path = require('path')
const glob = require('glob')
const fs = require('fs')
const SITE_ROOT = process.env.SITE_ROOT || 'https://www.actionherojs.com'
const SOURCE = process.env.SOURCE || path.join(__dirname, '..', 'pages', '/**/*.js')
const DESTINATION = process.env.DESTINATION || path.join(__dirname, '..', 'static', 'sitemap.xml')
@jaredpalmer
jaredpalmer / App.js
Created May 30, 2017 17:45
Next.js-like SSR without Next.js.
import React from 'react';
import Route from 'react-router-dom/Route';
import Link from 'react-router-dom/Link';
import Switch from 'react-router-dom/Switch';
const App = ({ routes, initialData }) => {
return routes
? <div>
<Switch>
{routes.map((route, index) => {
@neretin-trike
neretin-trike / pug.md
Last active July 25, 2024 15:54
Туториал по HTML препроцессору Pug (Jade)