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 { Adapter, AdapterSession, AdapterUser } from 'next-auth/adapters' | |
import { PrismaClient } from '@prisma/client' | |
import { PrismaClientKnownRequestError } from '@prisma/client/runtime' | |
import { User, Session } from '@prisma/client' | |
// PrismaAdapter customized to have more cleaner naming consistency | |
// (From: https://github.com/nextauthjs/next-auth/blob/main/packages/adapter-prisma/src/index.ts) | |
export function PrismaAdapter(p: PrismaClient): Adapter { | |
const toAdapterUser = (user: User): AdapterUser => { | |
return { |
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
package main | |
import ( | |
"fmt" | |
"log" | |
"os" | |
uuid "github.com/google/uuid" | |
"github.com/nareix/joy4/av/avutil" | |
"github.com/nareix/joy4/format/mp4" |
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
package app | |
import ( | |
"bytes" | |
"testing" | |
) | |
const ALLOC_SIZE = 64 * 1024 * 1024 | |
func BenchmarkAlloc1(b *testing.B) { |
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
{ | |
"name": "your-application", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"compile:pug": "pug src/*.pug --out dist/ --watch", | |
"compile:sass": "sass src/index.scss:dist/index.css --watch", | |
"build": "npm run compile:pug && npm run compile:sass", | |
"serve": "browser-sync start --server --serveStatic 'dist' --files 'dist'", |
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
require "faraday" | |
require "json" | |
require "awesome_print" | |
require "byebug" | |
module Geolocation | |
class Result | |
attr_reader :address_components, :formatted_address, :geometry, :place_id, :types | |
def initialize(address_components, formatted_address, geometry, place_id, types) |
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
require "rom" | |
require "rom/sql" | |
# | |
# ## Relationを定義 | |
# | |
# ROMのRelationは`ROM::Relation[:アダプタ名]`を継承したクラスとして定義する | |
# associationsブロックの中で`belongs_to`や`has_many`などの関連も定義をする | |
# ここで定義したRelationは下で出てくるROMの初期化の際にROMへの登録を行う必要がある。 |
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
require "rom" | |
require "rom/sql" | |
# | |
# ## Relation | |
# | |
# RelationはROM.rbにおいてアダプタ固有の操作をラップする永続化レイヤの責務を扱う | |
# SQLiteやMySQL固有の操作はAdapterに実装されており、それらに対するインターフェースを提供する | |
# (余談ではあるが、rom-sqlは中のSQLビルダにSequelを使っている) |
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
// | |
// Example for Immutable Record with validate.js | |
// | |
const _ = require("underscore"); | |
const I = require("immutable"); | |
const validate = require("validate.js"); | |
function ValidatableRecord(args, rules = {}) { | |
const _prototype = I.Record.prototype; |
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 React from "react"; | |
import { | |
StyleSheet, | |
TouchableWithoutFeedback, | |
View | |
} from "react-native"; | |
export class Notifications extends React.Component { | |
componentWillMount() { | |
this.state = { |
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
{ | |
"name": "SyncExtension", | |
"version": "0.1", | |
"manifest_version": 2, | |
"description": "Storage Sync Extension", | |
"permissions": [ "storage" ], | |
"browser_action": { |
NewerOlder