Skip to content

Instantly share code, notes, and snippets.

View bastienrobert's full-sized avatar
🎲
728

Bastien Robert bastienrobert

🎲
728
View GitHub Profile
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size:100%;font:inherit;vertical-align:baseline;margin:0;padding:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:none}table{border-collapse:collapse;border-spacing:0}a{text-decoration:none}

js bitwise cheat sheet

var INIT = 0x1      // 0 0 0 0 1
  , PENDING = 0x2   // 0 0 0 1 0
  , DONE = 0x4      // 0 0 1 0 0
  , ERROR = 0x8     // 0 1 0 0 0
  , SUCCESS = 0x10  // 1 0 0 0 0
  , ALL = 0x1f      // 1 1 1 1 1
@bastienrobert
bastienrobert / spinner.svg
Created February 21, 2020 09:12 — forked from juliendargelos/spinner.svg
Basic animated svg spinner
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bastienrobert
bastienrobert / bitcolor.js
Created February 21, 2020 09:12
Javascript functions for doing fast binary/hex/RGB color conversions using bitwise operations.
// convert 0..255 R,G,B values to binary string
RGBToBin = function(r,g,b){
var bin = r << 16 | g << 8 | b;
return (function(h){
return new Array(25-h.length).join("0")+h
})(bin.toString(2))
}
// convert 0..255 R,G,B values to a hexidecimal color string
RGBToHex = function(r,g,b){
@bastienrobert
bastienrobert / db.rake
Created April 21, 2020 12:34 — forked from ssaunier/db.rake
Rake task to back up heroku database and restore it locally.
namespace :db do
desc "Backs up heroku database and restores it locally."
task import_from_heroku: [ :environment, :create ] do
HEROKU_APP_NAME = nil # Change this if app name is not picked up by `heroku` git remote.
c = Rails.configuration.database_configuration[Rails.env]
heroku_app_flag = HEROKU_APP_NAME ? " --app #{HEROKU_APP_NAME}" : nil
Bundler.with_clean_env do
puts "[1/4] Capturing backup on Heroku"
`heroku pg:backups capture DATABASE_URL#{heroku_app_flag}`
@bastienrobert
bastienrobert / share-urls.md
Last active April 22, 2020 14:32 — forked from juliendargelos/share-urls.md
Share urls cheatsheet for social networks
@bastienrobert
bastienrobert / BrowserDeviceInfo.js
Last active August 15, 2021 09:23 — forked from TrevorJTClarke/BrowserDeviceInfo.js
List of browsers and devices for use in testing. Useful after Chrome removes HiDPI & MDPI laptop sizes in emulated devices.
var devices = [
{ name: 'Desktop - Huge', width: 2880, height: 1800, ratio: 2, type: 'desktop' },
{ name: 'Desktop - Extra Large', width: 1920, height: 1080, ratio: 1, type: 'desktop' },
{ name: 'Desktop - Large', width: 1440, height: 900, ratio: 1, type: 'desktop' },
{ name: 'Desktop - HiDPI', width: 1366, height: 768, ratio: 1, type: 'desktop' },
{ name: 'Desktop - MDPI', width: 1280, height: 800, ratio: 1, type: 'desktop' },
{ name: 'Laptop with HiDPI screen', width: 1440, height: 900, ratio: 2, type: 'desktop' },
{ name: 'Laptop with MDPI screen', width: 1280, height: 800, ratio: 1, type: 'desktop' },
{ name: 'Laptop with touch', width: 1280, height: 950, ratio: 1, type: 'desktop' },
{ name: 'Tablet - Portrait', width: 768, height: 1024, ratio: 1, type: 'tablet' },