This file contains 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
@-webkit-keyframes spinner-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } | |
@-moz-keyframes spinner-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } | |
@-o-keyframes spinner-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } | |
@-ms-keyframes spinner-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } | |
@keyframes spinner-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } | |
.fa-spinner.fa-spin { | |
-webkit-animation: spinner-spin 1s steps(8) infinite; | |
-moz-animation: spinner-spin 1s steps(8) infinite; | |
-o-animation: spinner-spin 1s steps(8) infinite; |
This file contains 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
var express = require('express') | |
var mongoskin = require('mongoskin') | |
var ObjectID = require('mongodb').ObjectID | |
var query2m = require('query-to-mongo') | |
// attach db to the router | |
var db = mongoskin.db('mongodb://localhost:27017/mydb', {safe: true}) | |
var router = express.Router() | |
router.db = db | |
router.use(function (req, res, next) { |
This file contains 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/bash | |
# | |
# Displays progress (to stderr) by counting lines from stdin. | |
# | |
# Usage: <command> | progress.sh <expected-line-count> > <file> | |
# | |
total=$(( ${1:-0} )) | |
number=0 |
This file contains 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
// UUID RFC 4122 Version 4 (random) | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
| |
void random_chars(char buffer[], int len) { | |
for (int i = 0; i < len; i++) { | |
sprintf(buffer + i, "%X", rand() % 16); | |
} |
This file contains 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
# get version info from git (look for tag like 'v1.0') | |
GIT_VERSION = $(shell git describe --match "v[0-9]*") | |
GIT_BUILD = $(shell git describe --match "v[0-9]*" --long --dirty) | |
GIT_COMMIT = $(shell git rev-parse --short HEAD) | |
GIT_COMMIT_LONG = $(shell git rev-parse HEAD) | |
define VERSION_BODY | |
# this file generated by build process | |
{ | |
"version": "${GIT_VERSION}", |
This file contains 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
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.Vector; | |
/** | |
* Flattens a Map | |
*/ | |
public class Flattener { | |
static public void process(Map<String, Object> target) { |
This file contains 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
import com.fasterxml.jackson.databind.ObjectMapper; | |
import org.junit.Test; | |
import java.io.IOException; | |
import java.util.Map; | |
import static org.junit.Assert.*; | |
public class FlattenerTest { | |
@Test |
This file contains 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
/* Semantic UI has these classes, however they're only applicable to*/ | |
/* grids, containers, rows and columns.*/ | |
/* plus, there isn't any `mobile hidden`, `X hidden` class.*/ | |
/* this snippet is using the same class names and same approach*/ | |
/* plus a bit more but to all elements.*/ | |
/* see https://github.com/Semantic-Org/Semantic-UI/issues/1114*/ | |
/* Portrait */ | |
@media only screen and (max-width: 414px) { |
This file contains 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
#!/usr/bin/env bash | |
tmp=$(mktemp -d) | |
trap "{ rm -rf $tmp; }" EXIT | |
# ensure we were given two command line arguments | |
if [[ $# -ne 2 ]]; then | |
echo 'usage: vault-cp SOURCE DEST' >&2 | |
exit 1 | |
fi |
This file contains 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 http = require('http') | |
const https = require('https') | |
async function fetch(url, options={rejectUnauthorized: false}, timeout=3000, log=true) { | |
await new Promise((resolve, reject) => { | |
const req = (/^https/.test(url) ? https : http) | |
.get(url, options, res => { | |
let data = '' | |
res.on('data', chunk => data+=chunk) | |
res.on('end', () => {log && console.log(data); resolve(data)}) |
OlderNewer