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
// create context with no upfront defaultValue | |
// without having to do undefined check all the time | |
function createCtx<A>() { | |
const ctx = React.createContext<A | undefined>(undefined) | |
function useCtx() { | |
const c = React.useContext(ctx) | |
if (!c) throw new Error("useCtx must be inside a Provider with a value") | |
return c | |
} | |
return [useCtx, ctx.Provider] as const |
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 { pbkdf2: deriveKey } = require("pbkdf2"); | |
const crypto = require("crypto"); | |
const DERIVATION_ROUNDS = 200000; | |
const HMAC_KEY_SIZE = 32; | |
const PASSWORD_KEY_SIZE = 32; | |
function pbkdf2(password, salt, rounds, bits) { | |
return new Promise((resolve, reject) => { | |
deriveKey(password, salt, rounds, bits / 8, "sha256", (err, key) => { |
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
async function getMostPopularPostSlugs({ | |
limit, | |
exclude, | |
}: { | |
limit: number | |
exclude: Array<string> | |
}) { | |
const result = await prisma.postRead.groupBy({ | |
by: ['postSlug'], | |
_count: true, |
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
"scripts": { | |
"dev": "node .dev/webpack.dev.server.js", | |
"dev-prod": "node .dev/webpack.dev.server.js --production", | |
"build": "rimraf ./dist && webpack --config .dev/webpack.config.production.js --colors", | |
}, | |
"devDependencies": { | |
"@babel/core": "7.0.0-beta.38", | |
"@babel/plugin-proposal-class-properties": "7.0.0-beta.38", | |
"@babel/plugin-proposal-decorators": "7.0.0-beta.38", | |
"@babel/plugin-transform-classes": "7.0.0-beta.38", |
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
import React from 'react-native'; | |
var { | |
AsyncStorage | |
} = React; | |
var LocalStorage = { | |
get: function (key) { | |
return AsyncStorage.getItem(key).then(function(value) { | |
return JSON.parse(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
/** | |
* The path to the fonts folder, relative to the | |
* compiled stylesheet | |
* | |
* @type String | |
*/ | |
$font-path: "../fonts/" !default; | |
/** |
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
--- | |
- name: Sync uploads between environments | |
hosts: web | |
remote_user: "{{ web_user }}" | |
vars: | |
project: "{{ wordpress_sites[site] }}" | |
project_root: "{{ www_root }}/{{ site }}" | |
tasks: |
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
var gulp = require('gulp'); | |
var sass = require('gulp-sass'); | |
var browserSync = require('browser-sync'); | |
var paths = { | |
scss: './sass/*.scss' | |
}; | |
gulp.task('sass', function () { | |
gulp.src('scss/app.scss') |
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
// ---- | |
// Sass (v3.3.0.rc.1) | |
// Compass (v0.13.alpha.10) | |
// ---- | |
$em-base: 16px; | |
@function strip-unit($num) { | |
@return $num / ($num * 0 + 1); | |
} | |
@function convert-to-rem($value, $base-value: $em-base) { |
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
/* RequireJS Ember.Handlebars Plugin v0.1.0 | |
* Copyright 2012, Tim Branyen (@tbranyen) | |
* hbs.js may be freely distributed under the MIT license. | |
*/ | |
define(["ember", "text"], function(Ember) { | |
var hbs = { | |
version: "0.1.0", | |
// Invoked by the AMD builder, passed the path to resolve, the require |
NewerOlder