I hereby claim:
- I am hansott on github.
- I am hansott (https://keybase.io/hansott) on keybase.
- I have a public key ASBaddsO2x5jvRIiL-ZL0phJiTgZq9kLLVljMuEG8Gq4Xwo
To claim this, I am signing this object:
export function getUserByEmail(mysql: MySQL, email: string) { | |
return await mysql.select( | |
"SELECT id, email, ... FROM users WHERE email = :email", | |
{ email: email } | |
); | |
} |
describe("ForgotPassword", () => { | |
test("it sends email when reset is requested", async () => { | |
const users = new UsersInMemory(); | |
const forgotPassword = new ForgotPassword(users); | |
// ... | |
}); | |
}); |
import { logger } from "./logger"; | |
import React, { useReducer } from "react"; | |
const reducer = (state, action) => state; | |
const initialState = {}; | |
export const Component = () => { | |
const [state, dispatch] = useReducer(logger(reducer), initialState); | |
return <div></div>; |
I hereby claim:
To claim this, I am signing this object:
# Hello, and welcome to makefile basics. | |
# | |
# You will learn why `make` is so great, and why, despite its "weird" syntax, | |
# it is actually a highly expressive, efficient, and powerful way to build | |
# programs. | |
# | |
# Once you're done here, go to | |
# http://www.gnu.org/software/make/manual/make.html | |
# to learn SOOOO much more. |
echo 'export PATH="$HOME/bin:$PATH";' >> ~/.bash_profile | |
mdkir ~/bin | |
ln -s ~/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl ~/bin/subl |
var http = require('http'); | |
var sockets = require('./sockets'); | |
var server = http.createServer(app); | |
sockets.connect(server); | |
sockets.emit('event', { message: 'This is an event!' }); |
1. `$ npm install gitlabhook` | |
2. Copy webhook.js in directory | |
3. Create systemd service, instructions can be found here: https://github.com/rolfn/node-gitlab-hook#installation-hints-for-linux | |
4. Or test using `node webhook.js` |
func timeAgoSinceDate(date:NSDate, numericDates:Bool) -> String { | |
let calendar = NSCalendar.currentCalendar() | |
let unitFlags = NSCalendarUnit.CalendarUnitMinute | NSCalendarUnit.CalendarUnitHour | NSCalendarUnit.CalendarUnitDay | NSCalendarUnit.CalendarUnitWeekOfYear | NSCalendarUnit.CalendarUnitMonth | NSCalendarUnit.CalendarUnitYear | NSCalendarUnit.CalendarUnitSecond | |
let now = NSDate() | |
let earliest = now.earlierDate(date) | |
let latest = (earliest == now) ? date : now | |
let components:NSDateComponents = calendar.components(unitFlags, fromDate: earliest, toDate: latest, options: nil) | |
if (components.year >= 2) { | |
return "\(components.year) years ago" | |
} else if (components.year >= 1){ |
@{ | |
var random = new Random(); | |
int r = random.Next(1000); | |
} | |
<p><img src="@Url.Content("~/images/records/" + Model.id + ".jpg")?time=@r" alt="Album cover" class="img-responsive" /></p> |