Add remote2
as a remote
$ git remote -v
remote2 git@github.com:repo2.git (fetch)
remote2 git@github.com:repo2.git (push)
origin git@github.com:repo.git (fetch)
origin git@github.com:repo.git (push)
import React, {Component} from 'react'; | |
import differenceInSeconds from 'date-fns/difference_in_seconds'; | |
import distanceInWordsToNow from 'date-fns/distance_in_words_to_now'; | |
class TimeAgo extends Component { | |
componentDidMount() { | |
if (this.props.isLive) { | |
this.updateTime(); | |
} |
# Backup | |
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
# Restore | |
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
-- requires an SMTP server to send emails | |
local smtp = require("socket.smtp") | |
local ltn12 = require("ltn12") | |
local mime = require("mime") | |
from = "<me@my.email.com>" | |
rcpt = { | |
"<somebob@testemail.com>" |
-- mathlib.lua | |
--[[ | |
Maths extension library for use in Corona SDK by Matthew Webster. | |
All work derived from referenced sources. | |
twitter: @horacebury | |
blog: http://springboardpillow.blogspot.co.uk/2012/04/sample-code.html | |
code exchange: http://code.coronalabs.com/search/node/HoraceBury | |
github: https://gist.github.com/HoraceBury |
require("list") | |
local a = { 3 } | |
local b = { 4 } | |
local l = list({ 2 }, a, b, { 5 }) | |
l:pop() | |
l:shift() | |
l:push({ 6 }) | |
l:unshift({ 7 }) |
local random = math.random | |
local function uuid() | |
local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx' | |
return string.gsub(template, '[xy]', function (c) | |
local v = (c == 'x') and random(0, 0xf) or random(8, 0xb) | |
return string.format('%x', v) | |
end) | |
end |
function postJson(method, url, params) { | |
let xhr = new XMLHttpRequest(); | |
xhr.open(method, url, true); | |
xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8'); | |
xhr.send(JSON.stringify(params)); | |
xhr.onreadystatechange = function() { | |
let status; | |
let data; | |
if (xhr.readyState === 4) { | |
status = xhr.status; |