Skip to content

Instantly share code, notes, and snippets.

View Aarbel's full-sized avatar
✍️
.

Clement Fradet Normand Aarbel

✍️
.
View GitHub Profile
@pesterhazy
pesterhazy / building-sync-systems.md
Last active May 17, 2025 15:08
Building an offline realtime sync engine

So you want to write a sync system for a web app with offline and realtime support? Good luck. You might find the following resources useful.

Overview articles

@Aarbel
Aarbel / embedded-file-viewer.md
Last active September 30, 2024 13:50 — forked from tzmartin/embedded-file-viewer.md
Free desktop and mobile files viewers and editors: Google Drive, OneDrive, Zoho public viewers and editors.

Desktop / Web

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

Format :

    http://view.officeapps.live.com/op/view.aspx?src=[ONLY_OFFICE_FILE_URL_ENCODED]
    
 
@donmccurdy
donmccurdy / FOO2GLTF.js
Last active January 15, 2025 22:26
Example Node.js glTF conversion script, using three.js.
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const THREE = require('three');
const program = require('commander');
const Canvas = require('canvas');
const { Blob, FileReader } = require('vblob');
// Patch global scope to imitate browser environment.
@Aarbel
Aarbel / mouse-drag-click-control.js
Created August 17, 2018 23:48
Way to know if the mouse moved during a click, and prevent event on click if needed. Usefull for THREE.js camera rotation
let mouseMoved = false;
document.addEventListener('mousedown', () => {
mouseMoved = false;
}, false);
document.addEventListener('mousemove', () => {
mouseMoved = true;
}, false);
@sorenlouv
sorenlouv / determine-changed-props.js
Last active April 18, 2024 16:21
Determine which props causes React components to re-render
import React, { Component } from 'react';
export default function withPropsChecker(WrappedComponent) {
return class PropsChecker extends Component {
componentWillReceiveProps(nextProps) {
Object.keys(nextProps)
.filter(key => {
return nextProps[key] !== this.props[key];
})
.map(key => {
@mtrunkat
mtrunkat / docker-mongo-repair
Last active March 19, 2024 06:28
Run "mongo --repair" in Docker container that cannot start because of MongoDB error
#!/bin/bash
# See https://github.com/docker-library/mongo/pull/63
docker run --rm --volumes-from my-mongo-server mongo unlink "/data/db/mongod.lock"
docker run --rm --volumes-from my-mongo-server mongo --repair
@tzmartin
tzmartin / embedded-file-viewer.md
Last active May 17, 2025 22:13
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

@johnnyji
johnnyji / codemod-add-semicolon.js
Last active April 14, 2018 16:48
Codemod for Babel 6 Semicolon Requirement
module.exports = function (file, api) {
var j = api.jscodeshift;
var root = j(file.source);
// Finds the all classes that have properties
root
.find(j.ClassDeclaration, {
body: {
type: 'ClassBody',
body: [{
@ourmaninamsterdam
ourmaninamsterdam / LICENSE
Last active February 9, 2025 08:41
Arrayzing - The JavaScript array cheatsheet
The MIT License (MIT)
Copyright (c) 2015 Justin Perry
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
@JakeSidSmith
JakeSidSmith / ellipsized-filenames.css
Last active March 13, 2019 17:42
CSS - ellipsis filename but keep extension
/* HTML
<div class="file">
<div class="icon"></div>
<span class="filename">
<span class="name">
Filename<span class="extension">.ext</span>
</span>
</span>