Skip to content

Instantly share code, notes, and snippets.

View whyvez's full-sized avatar

Yves Richard whyvez

View GitHub Profile
@moneal
moneal / firebase_pre-request_script.js
Created August 23, 2017 02:21
Postman pre-request script to create a Firebase authentication JWT header.
/**
* This script expects the global variables 'refresh_token' and 'firebase_api_key' to be set. 'firebase_api_key' can be found
* in the Firebase console under project settings then 'Web API Key'.
* 'refresh_token' as to be gathered from watching the network requests to https://securetoken.googleapis.com/v1/token from
* your Firebase app, look for the formdata values
*
* If all the data is found it makes a request to get a new token and sets a 'auth_jwt' environment variable and updates the
* global 'refresh_token'.
*
* Requests that need authentication should have a header with a key of 'Authentication' and value of '{{auth_jwt}}'
@sethvincent
sethvincent / README.md
Last active April 8, 2017 17:39
useful DOM element modules
@mbostock
mbostock / .block
Last active November 13, 2016 21:45
U.S. Atlas, Redux [UNLISTED]
license: bsd-3-clause
@alekseykulikov
alekseykulikov / index.md
Last active April 14, 2024 00:32
Principles we use to write CSS for modern browsers

Recently CSS has got a lot of negativity. But I would like to defend it and show, that with good naming convention CSS works pretty well.

My 3 developers team has just developed React.js application with 7668 lines of CSS (and just 2 !important). During one year of development we had 0 issues with CSS. No refactoring typos, no style leaks, no performance problems, possibly, it is the most stable part of our application.

Here are main principles we use to write CSS for modern (IE11+) browsers:

progrium/bashstyle

Bash is the JavaScript of systems programming. Although in some cases it's better to use a systems language like C or Go, Bash is an ideal systems language for smaller POSIX-oriented or command line tasks. Here's three quick reasons why:

  • It's everywhere. Like JavaScript for the web, Bash is already there ready for systems programming.
  • It's neutral. Unlike Ruby, Python, JavaScript, or PHP, Bash offends equally across all communities. ;)
  • It's made to be glue. Write complex parts in C or Go (or whatever!), and glue them together with Bash.

This document is how I write Bash and how I'd like collaborators to write Bash with me in my open source projects. It's based on a lot of experience and time collecting best practices. Most of them come from these two articles, but here integrated, slightly modified, and focusing on the most bang for buck items. Plus some ne

@max-mapper
max-mapper / test.js
Last active August 29, 2015 14:24
tape + http local server test scaffolding
// the two testing modules I like
var test = require('tape')
var spawn = require('tape-spawn')
var execspawn = require('npm-execspawn') // can spawn from require() scope, check it out!
// put this in outer scope so we can kill the local server at the end
var server
test('start test server', function (t) {
@whyvez
whyvez / backup
Last active August 29, 2015 14:24
#!/bin/bash
SERVER=yourwebsite.com
tar -cjf- ~/.crypt/passwd ~/.ssh ~/.bashrc ~/.profile ~/.vimrc ~/.gitconfig \
~/.config/chromium ~/.mozilla \
| openssl enc -aes-256-cbc \
| ssh $SERVER 'cat>~/www/backup/`date +%F.%T`'
ssh $SERVER 'ls -1 ~/www/backup | grep ^[0-9] | sort > ~/www/backup/list.txt'
@whyvez
whyvez / kill.sql
Created May 27, 2015 01:58
PG conections
-- get pid for db
SELECT state, client_addr, pid FROM pg_stat_activity where datname = 'afgo_qa';
-- kill pid for db
SELECT pg_terminate_backend(12193);
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@rclark
rclark / Issues.md
Last active January 28, 2024 01:18
Leaflet WMS + GetFeatureInfo

There are a bunch of reasons why this is convoluted, mostly in building the URL to make the request:

  1. You have to rely on an AJAX request, this example uses jQuery
  2. To make a GetFeatureInfo request, you must provide a BBOX for a image, and the pixel coordinates for the part of the image that you want info from. A couple of squirrely lines of Leaflet code can give you that.
  3. Output formats. The info_format parameter in the request. We don't know a priori which will be supported by a WMS that we might make a request to. See Geoserver's docs for what formats are available from Geoserver. That won't be the same from WMS to WMS, however.
  4. WMS services return XML docs when there's a mistake in the request or in processing. This sends an HTTP 200, which jQuery doesn't think is an error.