Skip to content

Instantly share code, notes, and snippets.

View Salakar's full-sized avatar
🐈
Fluttering right meow

Mike Diarmid Salakar

🐈
Fluttering right meow
View GitHub Profile
@osopolar
osopolar / com.user.time-machine-exclude-node-modules-job.plist
Last active December 20, 2022 08:44 — forked from peterdemartini/command.sh
Exclude node_modules (and more) from timemachine, use launchd to scan the Project directory on a regular basis, for example meanwhile you are having siesta. Put this file in ~/Library/LaunchAgents and call `launchctl load ~/Library/LaunchAgents/com.user.time-machine-exclude-node-modules-job.plist`
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.user.time-machine-exclude-node-modules-job</string>
<key>RunAtLoad</key>
<false/>
<key>KeepAlive</key>
<false/>
@bmeck
bmeck / bus.js
Created June 23, 2018 13:51
it is a better API at least
// Example way to construct a Bus
//
// const ctrl = new SharedArrayBuffer(12);
// const size = new SharedArrayBuffer(4);
// let busSize = 4096;
// const data = new SharedArrayBuffer(busSize);
// const bufs = {ctrl,size,data,};
// const bus = new Bus(bufs);
'use strict';
@bmeck
bmeck / commands.js
Last active June 29, 2018 15:44
Show fs.readFile callback acting as if it was sync in another thread (naive impl)
module.exports = {
__proto__: null,
START: 0,
WORKER_READY: 2,
BUS_READY: 3,
BUS_DRAINED: 4,
BUS_END: 5,
WORKER_ERROR: 6,
};
platform :ios, '9.3'
target 'rentcssbeta' do
rn_path = '../node_modules/react-native'
pod 'react-native-maps', path: '../node_modules/react-native-maps'
pod 'RNFirebase', path: '../node_modules/react-native-firebase/ios'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'Firebase/Crash'
@SheldonWangRJT
SheldonWangRJT / Convert .mov or .MP4 to .gif.md
Last active May 6, 2024 13:53
Convert Movie(.mov) file to Gif(.gif) file in one command line in Mac Terminal

This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.

Need

Convert .mov/.MP4 to .gif

Reason

As a developer, I feel better to upload a short video when I create the pull request to show other viewers what I did in this PR. I tried .mov format directly got after finishing recording screen using Quicktime, however, gif offers preview in most web pages, and has smaller file size.

This is not limited to developer, anyone has this need can use this method to convert the files.

@EQuimper
EQuimper / clear.txt
Created June 16, 2017 16:17
React-Native clear Watchman + Cache
watchman watch-del-all && rm -rf node_modules/ && yarn cache clean && yarn install && yarn start -- --reset-cache
@brennanMKE
brennanMKE / app.js
Created June 6, 2017 18:11
React Native JS Bundle Source Mapping for Debugging
var sourceMap = require('source-map');
var convert = require('convert-source-map');
var fs = require('fs');
var source = 'PATH_TO_APP/Myapp.app/main.jsbundle';
var content = fs.readFileSync(source, 'utf8');
var json = convert.fromComment(content).toJSON();
var smc = new sourceMap.SourceMapConsumer(json);
var position = smc.originalPositionFor({
@ndelangen
ndelangen / cluster-example.js
Created January 2, 2017 15:55
The cluster module allows you to easily create child processes that all share server ports.
const cluster = require('cluster');
const http = require('http');
const numCPUs = require('os').cpus().length;
if (cluster.isMaster) {
// Fork workers.
for (var i = 0; i < numCPUs; i++) {
cluster.fork();
}
@ndelangen
ndelangen / process1.js
Created January 2, 2017 15:06
If you have 2 independent NodeJS processes running and want them to communicate, this can be done reliably using a npm package: node-ipc
const ipc = require('node-ipc');
ipc.config.id = 'a-unique-process-name1';
ipc.config.retry = 1500;
ipc.config.silent = true;
ipc.serve(() => ipc.server.on('a-unique-message-name', message => {
console.log(message);
}));
ipc.server.start();
@ndelangen
ndelangen / spawn-node-ipc.js
Created January 2, 2017 15:01
Spawn can be used to create a process from any command.
const spawn = require('child_process').spawn;
const command = 'node';
const parameters = [path.resolve('program.js')];
const child = spawn(command, parameters, {
stdio: [ 'pipe', 'pipe', 'pipe', 'ipc' ]
});