Skip to content

Instantly share code, notes, and snippets.

View akr4's full-sized avatar

UEDA Akira akr4

  • Tokyo, Japan
View GitHub Profile
@nakamuuu
nakamuuu / ImagePager.kt
Last active August 19, 2023 04:51
ImagePager (Jetpack Compose)
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.exponentialDecay
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.Stable
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
@mike-neck
mike-neck / Scratch.java
Created May 13, 2019 09:04
しかたがないにゃ〜
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
class Scratch {
public static void main(final String[] args) {
final InputStream inputStream = new ByteArrayInputStream("foo,\nbar,\n,baz".getBytes(StandardCharsets.UTF_8));
final String string = toString(inputStream);
@tsukhu
tsukhu / Steps.md
Last active November 14, 2023 07:07
create-react-app with styled components

Here are the steps to convert the create-react-app generated to code to use styled components instead of css

  1. Created an app using create-react-app
create-react-app react-styledcomponents-app
  1. Install styled-components as a dependency
@zargony
zargony / config.yml
Last active December 16, 2020 16:47
CircleCI 2.0 configuration for Rust library crate project
version: 2
jobs:
test:
docker:
- image: rust:1
steps:
- checkout
- run:
name: Version information
@laughedelic
laughedelic / serialization.sc
Created September 7, 2017 02:27
Shows how to serialize-deserialize an object in Scala to a String
import java.io._
import java.util.Base64
import java.nio.charset.StandardCharsets.UTF_8
def serialise(value: Any): String = {
val stream: ByteArrayOutputStream = new ByteArrayOutputStream()
val oos = new ObjectOutputStream(stream)
oos.writeObject(value)
oos.close
new String(
@justinpawela
justinpawela / config
Created August 3, 2016 01:39
AWS CodeCommit Multiple Account Config
# This file is: ~/.ssh/config
# You may have other (non-CodeCommit) SSH credentials stored in this
# config file – in addition to the CodeCommit settings shown below.
# NOTE: Make sure to run [ chmod 600 ~/.ssh/config ] after creating this file!
# Credentials for Account1
Host awscc-account1 # 'awscc-account1' is a name you pick
Hostname git-codecommit.us-east-1.amazonaws.com # This points to CodeCommit in the 'US East' region
@robby
robby / gist:5493865
Created May 1, 2013 05:22
Show "No %@ Accounts" dialog for Twitter/Facebook when using SLRequest, Social.framework, ACAccountStore and Accounts.framework
dispatch_async(dispatch_get_main_queue(), ^{
SLComposeViewController *composer = [SLComposeViewController composeViewControllerForServiceType: slServiceType];
composer.view.hidden = YES;
[self presentViewController: composer animated: NO completion:^{
[composer.view endEditing: YES];
}];
});
@gereon
gereon / gist:3150445
Created July 20, 2012 12:20
Mac OSX Spotlight Enhancement

Mac OSX Spotlight Enhancement

Add this to Info.plist in /System/Library/Spotlight/RichText.mdimporter/Contents/ and Spotlight will search for source code files.

<string>public.c-header</string>
<string>public.c-plus-plus-header</string>
<string>public.c-source</string>
<string>public.objective-c-source</string>
public.c-plus-plus-source
@teigen
teigen / auth.scala
Created July 19, 2012 14:33
Unfiltered authentication example
package auth
import unfiltered.Cycle
import unfiltered.request.{HttpRequest, BasicAuth, Path}
import unfiltered.response._
import unfiltered.jetty.Http
import unfiltered.filter.Plan
object Req {
def apply[Req, Res](f:PartialFunction[HttpRequest[Req], HttpRequest[Req] => ResponseFunction[Res]]):Cycle.Intent[Req, Res] = {
@gclaramunt
gclaramunt / planes.scala
Created June 6, 2012 18:08
Very simple phantom types example
trait FlightStatus
trait Flying extends FlightStatus
trait Landed extends FlightStatus
case class Plane[Status <: FlightStatus]()
def land(p:Plane[Flying])=Plane[Landed]()
def takeOff(p:Plane[Landed])= Plane[Flying]()
val plane = new Plane[Landed]()