Discover gists
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 Document, { Head, Main, NextScript } from 'next/document' | |
export default class MyDocument extends Document { | |
static async getInitialProps(ctx) { | |
const initialProps = await Document.getInitialProps(ctx); | |
let props = { ...initialProps }; | |
return props; | |
} |
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
syntax="proto3"; | |
message Student { | |
int32 id = 1; | |
string name = 2; | |
} | |
message Question { | |
int32 id = 1; | |
string text = 2; |
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
# CLI | |
sudo apt update -y | |
sudo apt install -y \ | |
git curl \ | |
docker.io docker-buildx \ | |
build-essential pkg-config autoconf bison rustc cargo clang \ | |
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \ | |
libvips imagemagick libmagickwand-dev mupdf mupdf-tools \ | |
redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \ | |
rbenv apache2-utils |
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
/* | |
* Module dependencies. | |
*/ | |
var express = require('express') | |
, routes = require('./routes') | |
, user = require('./routes/user') | |
, common = require('./routes/common') | |
, fs = require('fs') | |
, http = require('http') | |
, util = require('util') |
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 epochToJsDate = (ts) => { | |
if (ts.length === 10) return new Date(ts*1000); | |
else if (ts.length === 13) return new Date(parseInt(ts)) | |
else return ts; | |
} | |
// payment.date = epochToJsDate(1500026871) |
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
Number.prototype.pad = function(size) { | |
var s = String(this); | |
while (s.length < (size || 2)) {s = "0" + s;} | |
return s; | |
} | |
(1).pad(3) // => "001" | |
(10).pad(3) // => "010" | |
(100).pad(3) // => "100" |
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
.site-logo { | |
display: inline-block; | |
height: 39px; | |
} | |
/* line 6, ../sass/partials/_block.scss */ | |
.site-logo img { | |
margin:0 auto 0 auto; | |
padding:0; | |
width:300px; | |
} |
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
SETUP: | |
wget -O drive https://drive.google.com/uc?id=0B3X9GlR6EmbnMHBMVWtKaEZXdDg | |
mv drive /usr/sbin/drive | |
chmod 755 /usr/sbin/drive | |
Now, simply run drive to start the authentication process. You'll get a link like this to paste and browse to in to your web browser: |
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 firebase = require('firebase-admin'); | |
var serviceAccountSource = require("./source.json"); // source DB key | |
var serviceAccountDestination = require("./destination.json"); // destiny DB key | |
const sourceAdmin = firebase.initializeApp({ | |
credential: firebase.credential.cert(serviceAccountSource) | |
}); | |
const destinyAdmin = firebase.initializeApp({ |
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
$pic = file_create_url('public://images/1417218384.jpg'); | |
$row['picture'] = [ | |
'data' => [ | |
'#type' => 'html_tag', | |
'#tag' => 'img', | |
'#attributes' => ['src' => $pic, 'width' => '70'], | |
], | |
]; |
NewerOlder