Skip to content

Instantly share code, notes, and snippets.

View westlinkin's full-sized avatar
🎯
Focusing

Wesley Lin westlinkin

🎯
Focusing
View GitHub Profile
@gabrielemariotti
gabrielemariotti / Readme.md
Last active March 2, 2024 23:10
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example:

@alotaiba
alotaiba / google_speech2text.md
Created February 3, 2012 13:20
Google Speech To Text API

Google Speech To Text API

Base URL: https://www.google.com/speech-api/v1/recognize
It accepts POST requests with voice file encoded in FLAC format, and query parameters for control.

Query Parameters

client
The client's name you're connecting from. For spoofing purposes, let's use chromium

lang
Speech language, for example, ar-QA for Qatari Arabic, or en-US for U.S. English

@aogilvie
aogilvie / string_encrypt_decrypt.md
Created August 19, 2013 08:52
Quick and sexy String encrypt / decrypt for Android

#Quick and sexy String encrypt / decrypt for Android

Sometimes you find yourself wanted to use SharedPrefs to hold something precious? Want to prevent those pesky rooted hackz0rs from looking in your SharedPreds? Here is a quick and sexy no-external-libs-required solution.

Notes;

  • I have declared everything static so you can create your own utility class and throw the following straight in.

  • 3rd party imports are not required. Use import android.util.Base64; for Base64, and import javax.crypto.*; for Cipher.

import 'package:flutter/material.dart';
class AnimatedCount extends ImplicitlyAnimatedWidget {
AnimatedCount({
Key key,
@required this.count,
@required Duration duration,
Curve curve = Curves.linear,
}) : super(duration: duration, curve: curve, key: key);
@komamitsu
komamitsu / AndroidManifext.xml
Created February 23, 2012 15:52
Android Simple web server using NanoHTTPD (http://elonen.iki.fi/code/nanohttpd)
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
@westlinkin
westlinkin / ExtAudioRecorder
Created August 21, 2013 08:07
record audio and save as .wav
package com.ihanghai.googlesearch
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import android.media.AudioFormat;
import android.media.AudioRecord;
import android.media.MediaRecorder;
import android.media.MediaRecorder.AudioSource;
@guohai
guohai / ArcTranslateAnimation.java
Created April 3, 2012 16:55
Curved Path Animation in Android
import android.graphics.PointF;
import android.view.animation.Animation;
import android.view.animation.Transformation;
// http://www.math.ubc.ca/~cass/gfx/bezier.html
public class ArcTranslateAnimation extends Animation {
private int mFromXType = ABSOLUTE;
private int mToXType = ABSOLUTE;
@thuytrinh
thuytrinh / MainActivity.java
Last active September 21, 2020 01:22
Create carousel view with ViewPager
package com.thuytrinh.cardselectordemo;
import android.os.Bundle;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.app.Activity;
/**
This code snippet shows how an Android activity can trigger a web based auth using webview and then use
the cookies from there to make subsequent calls to an API (since the api is checking the cookies to detect
sign in)
MyApplication: The root "controller" and the first activity in my app
OAuthLogin: A class that handles the web based login.
It montors the url change and if the user had been redirected to
a "success" page it sends out the cookie string to the root controller
Once the controller has the cookie, it sets those on the service that
@dismory
dismory / luna_pinyin.custom.yaml
Created April 15, 2012 13:13
鼠须管自定义方引号
# Author: dismory <http://zhihu.com/dismory>
#
# - 命名为:luna_pinyin.custom.yaml
# - 放到 ~/Library/Rime 目录下
# - 在菜单栏单击署鼠须管图标,下拉菜单里选择【重新部署】即可
#
# 此自定义方案是针对【朙月拼音】的,针对其它请修改文件名前缀 `luna_pinyin` 为其它。
patch:
"punctuator/full_shape/[" : ["「", "【"]