Skip to content

Instantly share code, notes, and snippets.

View stefanbc's full-sized avatar
🖖
Do; or do not. There is no // TODO

Stefan Cosma stefanbc

🖖
Do; or do not. There is no // TODO
View GitHub Profile
@lhorie
lhorie / longest-keyword-sequence.md
Last active November 14, 2022 23:21
What's the longest keyword sequence in Javascript?
@myshov
myshov / function_invocation.js
Last active January 21, 2024 15:14
11 Ways to Invoke a Function
console.log(1);
(_ => console.log(2))();
eval('console.log(3);');
console.log.call(null, 4);
console.log.apply(null, [5]);
new Function('console.log(6)')();
Reflect.apply(console.log, null, [7])
Reflect.construct(function(){console.log(8)}, []);
Function.prototype.apply.call(console.log, null, [9]);
Function.prototype.call.call(console.log, null, 10);
@adamreisnz
adamreisnz / package.json
Last active January 19, 2024 13:01
Simple pure npm scripts build process
{
"name": "project-name",
"description": "Template for static sites",
"version": "1.0.0",
"homepage": "http://www.project-name.com",
"author": {
"name": "Adam Reis",
"url": "http://adam.reis.nz"
},
"license": "UNLICENSED",
@PurpleBooth
PurpleBooth / README-Template.md
Last active April 29, 2024 02:38
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@james2doyle
james2doyle / create-repo.sh
Created March 20, 2015 19:42
Create a repo on Github from the command line
# replace james2doyle with your own github username
function git-create() {
if [ $# -eq 2 ]; then
# name of repo to be created
PROJECTNAME="$1"
DESCRIPTION="$2"
POST="{\"name\":\"$PROJECTNAME\",\"description\":\"$DESCRIPTION\"}"
curl –sS -u 'james2doyle' https://api.github.com/user/repos -d "$POST"
git remote add origin git@github.com:james2doyle/$PROJECTNAME.git
echo "remote origin added"
@jcsrb
jcsrb / select.js
Last active October 10, 2018 20:33
How open a <select> element programmatically
//Thank to @Formstone https://github.com/Formstone/Selecter/blob/master/src/jquery.fs.selecter.js
if (window.document.createEvent) { // All
var evt = window.document.createEvent("MouseEvents");
evt.initMouseEvent("mousedown", false, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
el.dispatchEvent(evt);
} else if (el.fireEvent) { // IE
el.fireEvent("onmousedown");
}
@domenic
domenic / 0-github-actions.md
Last active April 8, 2024 23:35
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with GitHub Actions

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:

  • It is much easier and requires less steps, because you are already authenticated with GitHub, so you don't need to share secret keys across services like you do when coordinate Travis CI and GitHub.
  • It is free, with no quotas.
  • Anecdotally, builds are much faster with GitHub Actions than with Travis CI, especially in terms of time spent waiting for a builder.
@ericelliott
ericelliott / essential-javascript-links.md
Last active April 22, 2024 10:15
Essential JavaScript Links
@addyosmani
addyosmani / README.md
Last active April 2, 2024 20:18 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version