Skip to content

Instantly share code, notes, and snippets.

View dmnsgn's full-sized avatar

Damien Seguin dmnsgn

View GitHub Profile
@dmnsgn
dmnsgn / resize-application.applescript
Created November 10, 2020 12:02
Resize the current front macOS window of an application
tell application "Google Chrome"
set bounds of front window to {0, 0, 1440, 900}
end tell
@dmnsgn
dmnsgn / resize-electron-window-from-devtools-in-renderer-process.js
Last active November 12, 2020 09:50
Resize Electron window from devtools in renderer process.
const { remote } = require("electron");
remote.getCurrentWindow().setBounds({
x: 0,
y: 0,
width: 1920,
height: 1080,
});
@dmnsgn
dmnsgn / SingletonEnforcer.js
Created April 16, 2016 17:43
ES6 singleton pattern: use Symbol to ensure singularity
// http://stackoverflow.com/a/26227662/1527470
const singleton = Symbol();
const singletonEnforcer = Symbol();
class SingletonEnforcer {
constructor(enforcer) {
if (enforcer !== singletonEnforcer) {
throw new Error('Cannot construct singleton');
}
@dmnsgn
dmnsgn / .eslintrc.js
Created July 23, 2015 13:31
.eslintrc Google JavaScript Style Guide (eslint v0.24.1)
{
// http://eslint.org/docs/rules/
"env": {
"browser": true, // browser global variables.
"node": false, // Node.js global variables and Node.js-specific rules.
"worker": false, // web workers global variables.
"amd": false, // defines require() and define() as global variables as per the amd spec.
"mocha": false, // adds all of the Mocha testing global variables.
"jasmine": false, // adds all of the Jasmine testing global variables for version 1.3 and 2.0.
I am attesting that this GitHub handle dmnsgn is linked to the Tezos account tz2AmQarWLeMoQVt2h9a4QYywTUtg8bH5t5B for tzprofiles
sig:spsig1enZE4k2VP8aj8J6kJLQLLXrRVUXmT8R2CTDdKqYqKUdNH4rNxu1DwTcpdvdToMEnYnr5PgZuVohjZFnJiCCcLDz9Jkqnz
console.log("foo");
// Author: Abhishek Dutta, 12 June 2020
// License: CC0 (https://creativecommons.org/choose/zero/)
export default function uuid() {
var temp_url = URL.createObjectURL(new Blob());
var uuid = temp_url.toString();
URL.revokeObjectURL(temp_url);
return uuid.substr(uuid.lastIndexOf('/') + 1); // remove prefix (e.g. blob:null/, blob:www.test.com/, ...)
}
@dmnsgn
dmnsgn / SingletonDefaultExportInstance.js
Last active February 9, 2023 16:54
ES6 singleton pattern: module default exports an instance
class SingletonDefaultExportInstance {
constructor() {
this._type = 'SingletonDefaultExportInstance';
}
singletonMethod() {
return 'singletonMethod';
}
static staticMethod() {
@dmnsgn
dmnsgn / SingletonModuleScopedInstance.js
Created April 16, 2016 17:41
ES6 singleton pattern: constructor return an instance scoped to the module
// http://amanvirk.me/singleton-classes-in-es6/
let instance = null;
class SingletonModuleScopedInstance {
constructor() {
if (!instance) {
instance = this;
}
this._type = 'SingletonModuleScopedInstance';
@dmnsgn
dmnsgn / JavaScript landscape: compilers, bundlers and others by the numbers.md
Last active October 31, 2023 22:28
A non-exhaustive list of tools for JavaScript development as it has become "complicated".

JavaScript landscape: compilers, bundlers and others by the numbers

A non-exhaustive list of tools for JavaScript development as it has become "complicated".

Compilers

Name: language Stars Last Commit Owner/Sponsorship
tsc: JavaScript GitHub Repo stars GitHub last commit Microsoft
[babel]