Skip to content

Instantly share code, notes, and snippets.

View yann-yinn's full-sized avatar

Yann yann-yinn

  • Yann
  • France, Nantes
View GitHub Profile
@Herve07h22
Herve07h22 / self-attention.py
Created March 30, 2023 16:05
Example of self-attention model
import torch
import torch.nn as nn
class SelfAttention(nn.Module):
def __init__(self, embed_size, heads):
super(SelfAttention, self).__init__()
self.embed_size = embed_size
self.heads = heads
self.head_dim = embed_size // heads
@zachleat
zachleat / gist:f100f71a8ad2bad57d65511290717f1c
Created September 7, 2020 21:42
Eleventy Benchmark September 7, 2020 (Eleventy 1.0 Alpha Build)
---------------------------------------------------------
Eleventy Benchmark (Node v14.9.0, 1000 templates each)
---------------------------------------------------------
Eleventy 0.10.0
---------------------------------------------------------
liquid: ... 3 runs
* Median: 1.02 seconds
* Median per template: 1 ms
njk: ... 3 runs
@gatsbyjs-employees
gatsbyjs-employees / Open letter to the Gatsby community.md
Last active February 23, 2021 00:24
Open letter to the Gatsby community

To the Gatsby Community,

We want to start by specifically thanking Nat Alison. We support her and commend her bravery in speaking out. It is not easy to stand alone. What she experienced at Gatsby was unacceptable and speaks to wider issues. We thank her for putting pressure on the company to fix them. We vow to double down on those efforts.

While we have worked hard to give feedback and help create a healthy work environment over the past few years, change has been far too slow and the consequences have been real. The previous weeks have intensified the need for rapid change by increasing employee communication and allowing us to collectively connect some dots. We are just as outraged. As a result, we have posed a series of hard questions to management as well as a list of concrete actions they need to take.

Kyle Mathews' public apologies to both Nat Alison and Kim Crayton are small actions swiftly taken that signal the possibility for change but don't speak to the systemic issues that must be addressed.

const uploadInput = document.querySelector('input[type="file"]');
const awsFormData = JSON.parse(uploadEl.getAttribute('data-form-data'));
const formData = new FormData();
Object.keys(awsFormData).forEach((key)=>{
formData.append(key, awsFormData[key]);
});
uploadInput.addEventListener('change', function(ev){
ev.preventDefault();
@dabit3
dabit3 / useQuery.js
Created October 29, 2018 21:45
Querying when component renders
import React, { useEffect, useState } from 'react'
import { API, graphqlOperation } from 'aws-amplify'
const query = `
query {
listTodos {
items {
id
name
description
@vktr
vktr / rule.js
Created February 10, 2018 18:54
Add Stripe Customer Id to Auth0 via custom rule
function (user, context, callback) {
user.app_metadata = user.app_metadata || {};
if ('stripe_customer_id' in user.app_metadata) {
context.idToken['https://example.com/stripe_customer_id'] = user.app_metadata.stripe_customer_id;
return callback(null, user, context);
}
var stripe = require('stripe')('sk_....');
var customer = {
@mjs
mjs / fib.rs
Created August 25, 2017 01:54
Fibonacci sequence generation done in 3 ways using Rust
const ITERS: usize = 20;
fn print_fib(n: usize) {
let mut x = (1, 1);
for i in 0..n {
println!("{}: {}", i, x.0);
x = (x.1, x.0 + x.1)
}
}
@raphaellondner-mongodb
raphaellondner-mongodb / lambda-mongodb-example
Last active March 11, 2020 02:37
MongoDB-Lambda-Example
'use strict'
const AWS = require('aws-sdk');
var MongoClient = require('mongodb').MongoClient;
let atlas_connection_uri;
exports.handler = (event, context, callback) => {
var uri = process.env['MONGODB_ATLAS_CLUSTER_URI'];
if (atlas_connection_uri != null) {

Status

This extension was developed as part of the jsonapi module for Drupal.

Introduction

The JSON API specification is agnostic about how a server implements filtering strategies. In fact, the spec says:

Note: JSON API is agnostic about the strategies supported by a server. The filter query parameter can be used as the basis for any number of filtering strategies.