Skip to content

Instantly share code, notes, and snippets.

View Samuel-Martineau's full-sized avatar
👋
Salut!

Samuel Martineau Samuel-Martineau

👋
Salut!
View GitHub Profile
@dkchiem
dkchiem / create-comments.md
Created June 9, 2020 03:50
Create organized comments

Create comments

This will generate a comment to put into code files

read -p 'Title: ' text
read -p 'Number of characters on each side [default 10]: ' sideCharacters
read -p 'Prefix [enter for none]: ' prefix
echo This is the generated comment for \""${text}"\":
echo 
@hwangbible
hwangbible / example.js
Last active December 6, 2023 21:59
Scriptablify - lets you require('modules') in Scriptable app!
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: gray; icon-glyph: magic;
// Defaults to the latest version and no automatic update; if the file exists, just use it
const moment = await require('moment');
// Use any SemVer options to specify a version you want
// Refer to the calculator here: https://semver.npmjs.com/
const lodash = await require('lodash@^3.9.1');
@ernsheong
ernsheong / access-mac-localhost-from-parallels-desktop-ie-edge.md
Last active January 24, 2024 00:30
Accessing macOS localhost from Parallels Desktop IE or Edge

Access macOS localhost from IE or Edge within Parallels Desktop

This issue is so infuriating that I'm going to take some time to write about it.

  1. MOST IMPORTANT. Your local development server must be bound to IP address 0.0.0.0. Some do this by default, but many don't. You need to make sure that you run your local server with correct IP bindings. You may need to provide additional flags to your serve commands e.g. polymer serve --hostname domain.local, hugo serve --bind 0.0.0.0. If you use a named domain like domain.local, it has to be defined in /etc/hosts and pointing at 0.0.0.0.

  2. My Parallels setting is using Shared Network, nothing special there.

  3. Open macOS Terminal and type ifconfig. Look for the value under vnic0 > inet. It is typically 10.211.55.2.

@anacampesan
anacampesan / copyToClipboard.html
Last active May 20, 2021 10:41
Copy to clipboard without input
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<div id="secretInfo" style="display: none;">secret info</div>
<button type="button" id="btnCopy">Copy hidden info</button>
@ericclemmons
ericclemmons / example.md
Last active April 24, 2024 18:09
HTML5 <details> in GitHub

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

<details>
 Summary Goes Here
@venning
venning / standard_deviation.js
Created October 17, 2015 09:10
Standard Deviation with lodash
// NOTE requires lodash v3.4.0+ (for _.sum) and Node 4.0+ (for arrow function)
var _ = require('lodash');
function σ (array) {
var avg = _.sum(array) / array.length;
return Math.sqrt(_.sum(_.map(array, (i) => Math.pow((i - avg), 2))) / array.length);
};
@PaulMougel
PaulMougel / client.js
Last active May 1, 2024 12:38
File upload in Node.js to an Express server, using streams
// node: v0.10.21
// request: 2.27.0
var request = require('request');
var fs = require('fs');
var r = request.post("http://server.com:3000/");
// See http://nodejs.org/api/stream.html#stream_new_stream_readable_options
// for more information about the highWaterMark
// Basically, this will make the stream emit smaller chunks of data (ie. more precise upload state)
var upload = fs.createReadStream('f.jpg', { highWaterMark: 500 });
@marioBonales
marioBonales / .bashrc
Created January 19, 2012 03:56
Default .bashrc for ubuntu
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace