This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Decoding | |
SELECT CONVERT_FROM(DECODE(field, 'BASE64'), 'UTF-8') FROM table; | |
-- Encoding | |
SELECT ENCODE(CONVERT_TO(field, 'UTF-8'), 'base64') FROM table; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<table> | |
{% for record in records %} | |
<tr class="record{% if loop.index is divisibleby(2) %}even{% else %}odd{% endif %}"> | |
<td>{{ record.id }}</td> | |
<td>{{ record.title }}</td> | |
</tr> | |
{% endfor %} | |
</table> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Camelize a string, cutting the string by separator character. | |
* @param string Text to camelize | |
* @param string Word separator (underscore by default) | |
* @return string Camelized text | |
*/ | |
function camelize(text, separator) { | |
// Assume separator is _ if no one has been provided. | |
if(typeof(separator) == "undefined") { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
driver.manage().logs() | |
.get('browser') | |
.then(v => v && v.length && console.log(v)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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 '); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"encoding/binary" | |
"fmt" | |
"log" | |
"os" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Based on http://nrocco.github.io/2012/04/19/git-pre-commit-hook-for-PHP.html post | |
# | |
# Do not forget to: chmod +x .git/hooks/pre-commit | |
BAD_PHP_WORDS='var_dump|die|todo' | |
BAD_TWIG_WORDS='{{ dump(.*) }}' | |
EXITCODE=0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Uncamelize a string, joining the words by separator character. | |
* @param string Text to uncamelize | |
* @param string Word separator | |
* @return string Uncamelized text | |
*/ | |
function uncamelize(text, separator) { | |
// Assume separator is _ if no one has been provided. | |
if(typeof(separator) == "undefined") { |
NewerOlder