Skip to content

Instantly share code, notes, and snippets.

View Webkadabra's full-sized avatar
🏠
Working from your mom's house

WEBKADABRA Webkadabra

🏠
Working from your mom's house
  • (independent developer)
  • Ukraine
View GitHub Profile
@Webkadabra
Webkadabra / resize.ts
Created August 27, 2021 15:02 — forked from IsaiahByDayah/resize.ts
Example express endpoint that resizes an image from B2 Cloud Storage
import * as admin from "firebase-admin"
import express from "express"
import sharp, { ResizeOptions, OutputOptions } from "sharp"
import fetch from "cross-fetch"
import FileType from "file-type"
import { parseQueryNumber, parseQueryString } from "../some/extra/util/functions"
import { Photo } from "../some/custom/types"
const router = express.Router()
@pulkitsinghal
pulkitsinghal / 01-override-User-model.js
Created December 2, 2014 03:27
Strongloop/Loopback - Override User model via boot script
module.exports = function(app) {
var User = app.models.User;
// TODO: (1) find an example of how to add new "properties" to the built-in User mode via boot script
// (2) This is how you can add a "relationship" to the built-in User model via boot script
var SomeOtherModel = app.models.SomeOtherModel;
User.hasMany(SomeOtherModel, {as: 'someOtherModels', foreignKey: 'someOtherModelId'});
// (3) This is how you can add "remote methods" to the built-in User model via boot script
@branneman
branneman / better-nodejs-require-paths.md
Last active June 29, 2024 16:00
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@taylor
taylor / gist:2968566
Created June 21, 2012 21:12
fix ca cert on centos 5

this sucks, but it works. centos should really just build the damn ca-certificates package for centos5 found on centos6

cp /etc/pki/tls/certs/ca-bundle.crt /root/ca-bundle.crt-old
curl http://curl.haxx.se/ca/cacert.pem -o /etc/pki/tls/certs/ca-bundle.crt