Skip to content

Instantly share code, notes, and snippets.

View danBamikiya's full-sized avatar
😉
Trying to do the impossible

Dan Bamikiya danBamikiya

😉
Trying to do the impossible
View GitHub Profile
@blueskyarea
blueskyarea / git command
Last active April 19, 2021 16:15
git-command
// add remote repository to local git
git remote add origin {remote repository url}
// pushes up the all repository
git push -u origin --all
// pushes up any tags
git push -u origin --tags
// cancel one before commit
@paulirish
paulirish / webfont-performance-notes.md
Last active April 2, 2024 17:36
webfont performance notes

Just jotting some notes on delivering webfonts performantly…

still an incomplete draft.

Any critical fonts must be requested asap.

Critical fonts are neccessary for the above-the-fold content to be useful. Identify which of the fonts you NEED for the first render, as they get very different treatment vs the others.

You want the network reqs for your critical fonts to start ASAP. ideally the @font-face req is in a style tag, following CRP guidelines

@ChaseFlorell
ChaseFlorell / Execute.ps1
Last active July 28, 2021 11:03
Passing switches to child functions within PowerShell
# this is the final (child) function being called
function Invoke-Foo {
[cmdletbinding()]
param([switch] $Custom)
Write-Host 'Hello world'
Write-Verbose 'I''m a verbose message'
Write-Debug 'I''m a debug message' #this will pause execution
if($Custom.IsPresent){
Write-Host 'I''m a custom message'
@andrew8088
andrew8088 / stringify.js
Last active August 23, 2022 07:54
A simple implementation of JSON.stringify; covers every case I could think of
function stringify(obj) {
if (typeof obj !== 'object' || obj === null || obj instanceof Array) {
return value(obj);
}
return '{' + Object.keys(obj).map(function (k) {
return (typeof obj[k] === 'function') ? null : '"' + k + '":' + value(obj[k]);
}).filter(function (i) { return i; }) + '}';
}
@etaubman
etaubman / ShortenNumbers.js
Last active April 10, 2021 23:11
Shorten Numbers Using Javascript
function shortenNumber(n, d) {
if (n < 1) return "<1";
var k = n = Math.floor(n);
if (n < 1000) return (n.toString().split("."))[0];
if (d !== 0) d = d || 1;
function shorten(a, b, c) {
var d = a.toString().split(".");
if (!d[1] || b === 0) {
return d[0] + c
@millermedeiros
millermedeiros / example.js
Last active March 9, 2026 15:00
execute multiple shell commands in series on node.js
// USAGE ------
// ============
var shell = require('./shellHelper');
// execute a single shell command
shell.exec('npm test --coverage', function(err){
console.log('executed test');
}});
@mbostock
mbostock / .block
Last active June 18, 2026 16:00 — forked from mbostock/.block
Tidy Tree
license: gpl-3.0
border: no
height: 2000
redirect: https://beta.observablehq.com/@mbostock/d3-tidy-tree
@jaysonrowe
jaysonrowe / FizzBuzz.js
Created January 11, 2012 01:39
FizzBuzz JavaScript solution
for (var i=1; i <= 20; i++)
{
if (i % 15 == 0)
console.log("FizzBuzz");
else if (i % 3 == 0)
console.log("Fizz");
else if (i % 5 == 0)
console.log("Buzz");
else
console.log(i);