View pythonizeJsonDump.js
/* | |
Python and Node don't stringify JSON object the same way. | |
Python adds some spaces after `:` and `,`, causing some trouble if | |
you try to compute the same hashes across languages. | |
Here is a Node function turning a Node generated JSON string into | |
its Python equivalent. | |
*/ | |
export const pythonizeJsonDump = (jsonDump) => | |
jsonDump.replace(/(?!\B"[^"]*)(:|,)(?![^"]*"\B)/g, '$1 '); |
View snippet.sh
aws logs start-query \ | |
--profile [PROFILE] \ | |
--log-group-name [GROUP_NAME] \ | |
--start-time `date --date="-30 minutes" "+%s"` \ | |
--end-time `date "+%s"` \ | |
--query-string 'fields @message | limit 50' \ | |
| jq '.queryId' \ | |
| xargs -I{} aws --profile [PROFILE] logs get-query-results --query-id {} \ | |
| jq '.results | .[][0].value' |
View snippet.js
const COLUMN_NAME = "Deployed to Prod" | |
var column = [...document.querySelectorAll(".BoardBody-column")].filter( | |
column => | |
column.querySelector('.BoardColumnHeader-name') && | |
column.querySelector('.BoardColumnHeader-name').textContent == COLUMN_NAME | |
)[0] | |
Array.from(column.querySelectorAll(".BoardCard")).map(card => { | |
card.querySelector(".BoardCard-dropdownButton").click() |
View javascript.json
{ | |
"Create new functional component": { | |
"prefix": "_compo", | |
"body": [ | |
"import React from 'react';", | |
"import PropTypes from 'prop-types';", | |
"", | |
"export const $1 = ({$2}) => (", | |
" $3", | |
");", |
View Dockerfile
# config/php/Dockerfile | |
FROM php:7.0-fpm | |
RUN apt-get update | |
RUN apt-get install -y zlib1g-dev && docker-php-ext-install -j$(nproc) zip | |
RUN \ | |
apt-get install -y libpng-dev libjpeg62-turbo-dev libfreetype6-dev && \ | |
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \ | |
docker-php-ext-install -j$(nproc) gd |
View gist:4b93a9c9745af5345182fadd0176d298
driver.manage().logs() | |
.get('browser') | |
.then(v => v && v.length && console.log(v)); |
View test.js
const typeFinder = type => function* (params = {}, ref = 'master') { | |
const search = function* (searchParams) { | |
const Api = yield initApi; | |
const reference = ref === 'master' ? Api.master() : ref; | |
const preparedForm = Api.form('everything') | |
.ref(reference) | |
.pageSize(200); | |
const predicates = []; |
View couvent.js
// couvent.js - MIT license | |
Array.prototype.slice.call(document.querySelectorAll('*')).forEach(function (el) { | |
el.style.display = 'none'; | |
}); |
View db-save.sh
#!/bin/bash | |
# @see http://www.jonathan-petitcolas.com/2015/09/21/dump-docker-ized-database-to-amazon-s3.html | |
# Configuration | |
FILENAME="awesomeproject-`date +%Y-%m-%d-%H:%M:%S`.sql" | |
CONTAINER_NAME="awesomeproject_pgsql" | |
DUMPS_FOLDER="/home/awesomeproject/dumps" | |
BUCKET_NAME="awesomeproject-private" |
View Application.js
import View from "./folder/View"; | |
class Application { | |
constructor() { | |
this.view = new View("I'm a view!"); | |
} | |
sayHello() { | |
console.log("Hello"); | |
} |
NewerOlder