Skip to content

Instantly share code, notes, and snippets.

View Bertrand's full-sized avatar

Bertrand Guiheneuf Bertrand

View GitHub Profile

CSS

  • What is CSS selector specificity and how does it work?
  • What's the difference between a relative, fixed, absolute and statically positioned element?
  • Can you explain the difference between px, em and rem as they relate to font sizing?

JS Questions

HTML

  • What are data- attributes good for?
  • Describe the difference between <script>, <script async> and <script defer>.
  • Why is it generally a good idea to position CSS <link>s between <head></head> and JS <script>s just before </body>? Do you know any exceptions?
  • Why you would use a srcset attribute in an image tag? Explain the process the browser uses when evaluating the content of this attribute.
  • What is the difference between canvas and svg?
  • What is progressive rendering?

CSS

@Bertrand
Bertrand / setup.sh
Created October 10, 2018 12:11
scripts/setup.sh
#!/bin/bash
mongodb1=`getent hosts ${MONGO1} | awk '{ print $1 }'`
mongodb2=`getent hosts ${MONGO2} | awk '{ print $1 }'`
mongodb3=`getent hosts ${MONGO3} | awk '{ print $1 }'`
port=${PORT:-27017}
echo "Waiting for startup.."
until mongo --host mongo:27017 --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)' &>/dev/null; do
version: '3'
services:
mongo:
image: mongo:latest
volumes:
- .tockmongo:/data/db
ports:
- "27017:27017"
@Bertrand
Bertrand / Dictionary.js
Last active December 24, 2015 09:49 — forked from ngs/Dictionary.js
var Dictionary;
if (!Dictionary) {
Dictionary = {};
}
(function () {
'use strict';
function f(n) {
// Format integers to have at least two digits.
@Bertrand
Bertrand / grrr.sh
Created November 9, 2012 13:41
merge master into staging and staging into testing
#!/bin/sh
git diff --quiet --exit-code
if [ $? -ne 0 ]; then
echo "Cannot run grrr if you have uncommited changes"
exit -1;
fi
current_branch=`git rev-parse --abbrev-ref HEAD`
if [ "$current_branch" == "HEAD" ]; then
@Bertrand
Bertrand / build-falcon-fotonauts-ruby.sh
Created August 1, 2012 16:31
Build a ruby version with falcon and fotonauts patches
RUBY_MAJOR=1
RUBY_MINOR=9
RUBY_TEENY=3
RUBY_PATCH_LEVEL=194
RUBY_NAME="$RUBY_MAJOR.$RUBY_MINOR.$RUBY_TEENY-p$RUBY_PATCH_LEVEL-falcon-fotonauts"
BRANCH_NAME="falcon_and_fotonauts_""$RUBY_MAJOR""_""$RUBY_MINOR""_""$RUBY_TEENY""_""$RUBY_PATCH_LEVEL"
cat <<-EOS > "/tmp/$RUBY_NAME"
def smallAsciiRepresentation(digest)
digestParts = digest.unpack("Q2") # digest is a 128 bit buffer, cut it into two 64 bits ruby Integer
smallDigestPart = digestParts[0] ^ digestParts[1] # XOR the two 64 bits parts
smallDigest = [smallDigestPart].pack("Q") # and transform the result into a 64 bits binary buffer
smallDigestB64 = [smallDigest].pack("m") # b64-encode the result
smallID = smallDigestB64.gsub(/[\n=]/, '').gsub(/\+/,'-').gsub(/\//,'_') # and make it URL-friendly by shortening it (no '=' at the end, no '+', no '/')
return smallID
end