Skip to content

Instantly share code, notes, and snippets.

View olivoil's full-sized avatar

Olivier Melcher olivoil

View GitHub Profile
Mix.install(
[
{:phoenix_playground, "~> 0.1.0"},
{:openai, "~> 0.6.1"}
],
config: [
openai: [
api_key: System.get_env("OPENAI_API_KEY"),
organization_key: System.get_env("OPENAI_ORGANIZATION_KEY")
]
@Vanchel
Vanchel / outlined_input_border.dart
Last active April 24, 2025 12:23
Border with label placed inside (Flutter 3.22)
import 'package:flutter/material.dart';
class OutlinedInputBorder extends InputBorder {
/// Creates a rounded rectangle outline border for an [InputDecorator].
///
/// If the [borderSide] parameter is [BorderSide.none], it will not draw a
/// border. However, it will still define a shape (which you can see if
/// [InputDecoration.filled] is true).
///
/// If an application does not specify a [borderSide] parameter of
@easantillan
easantillan / README.md
Created June 28, 2023 02:51 — forked from jesster2k10/README.md
Rails API Social Login

Rails API-Only Social Login

This is another piece of code I've extrapolated from a Ruby on Rails project I'm currently working on. The code implmenets social login with a RoR API-based application, targeted at API clients.

The setup does not involve any browser-redirects or sessions as you would have to use working with Omniauth. Instead, what it does is takes an access_token generated on client-side SDKs, retireves user info from the access token and creates a new user and Identity in the database.

This setup works with native applications as described in the Google iOS Sign In Docs (see Authenticating with a backend server)

@SashaKryzh
SashaKryzh / app_colors_extension.dart
Last active December 5, 2024 01:53
Flutter ThemeExtension for custom app colors.
import 'package:flutter/material.dart';
/// `ThemeExtension` template for custom colors.
///
/// For example purposes, it has all required fields from the default Material `ColorScheme`.
/// But you can add, rename and delete any fields your need.
///
/// ### Motivation
///
/// At the beginning, you may not know if your colors will fit into the Material `ColorScheme`,
@RuckyZucky
RuckyZucky / main.dart
Created January 26, 2023 23:23
Flutter go_router ShellRoute Hero example
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
void main() {
runApp(MyApp());
}
final _rootKey = GlobalKey<NavigatorState>();
final _nestedKey = GlobalKey<NavigatorState>();
@jorgemanrubia
jorgemanrubia / sync_hey_world_posts_with_jekyll.rb
Created January 25, 2023 08:39
Script I use to sync my HEY World posts with my Jekyll-powered personal site
require "rss"
require "ostruct"
RSS_FEED_URL = "https://world.hey.com/jorge/feed.atom"
def sync_posts
feed = RSS::Parser.parse(RSS_FEED_URL, false)
feed.items.each do |item|
post = OpenStruct.new title: item.title.content, date: item.published.content.strftime("%Y-%m-%d"), link: item.link.href
@jesster2k10
jesster2k10 / base_provider_spec.rb
Created April 26, 2020 15:17
Social Login Specs
require 'rails_helper'
RSpec.describe External::Provider::Base do
let(:subject) { described_class.new SecureRandom.hex }
describe '#for' do
it 'returns Facebook provider' do
class_instance = described_class.for :facebook
expect(class_instance).to eq(External::Provider::Facebook)
end
@swyxio
swyxio / readme.md
Last active January 16, 2022 10:36
svelte society day talks and resources -
@jesster2k10
jesster2k10 / README.md
Last active December 4, 2024 05:20
Rails API Social Login

Rails API-Only Social Login

This is another piece of code I've extrapolated from a Ruby on Rails project I'm currently working on. The code implmenets social login with a RoR API-based application, targeted at API clients.

The setup does not involve any browser-redirects or sessions as you would have to use working with Omniauth. Instead, what it does is takes an access_token generated on client-side SDKs, retireves user info from the access token and creates a new user and Identity in the database.

This setup works with native applications as described in the Google iOS Sign In Docs (see Authenticating with a backend server)

@escamoteur
escamoteur / nextField.dart
Created September 13, 2019 12:22
So easy is it now to implement a next field behavior for forms, meaning that the focus is moved as soon the user tabs the next button on the keyboard
class _MyHomePageState extends State<MyHomePage>
with SingleTickerProviderStateMixin {
TabController _tabController;
FocusScopeNode _node = FocusScopeNode(); /// <-----------------
@override
void initState() {
_tabController = TabController(length: 3, vsync: this);