Skip to content

Instantly share code, notes, and snippets.

@JamieMason
JamieMason / group-objects-by-property.md
Created September 14, 2018 07:38
Group Array of JavaScript Objects by Key or Property Value

Group Array of JavaScript Objects by Key or Property Value

Implementation

const groupBy = key => array =>
  array.reduce((objectsByKeyValue, obj) => {
    const value = obj[key];
    objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
    return objectsByKeyValue;
@Jung0
Jung0 / .commit_template
Last active February 26, 2024 05:43
🤘 Emoji prefix to use at commit message
# ==================== Emojis ====================
# 🎉 :tada: 初めてのコミット(Initial Commit)
# 🔖 :bookmark: バージョンタグ(Version Tag)
# ✨ :sparkles: 新機能(New Feature)
# 🐛 :bug: バグ修正(Bagfix)
# ♻️ :recycle: リファクタリング(Refactoring)
# 📚 :books: ドキュメント(Documentation)
# 🎨 :art: デザインUI/UX(Accessibility)
@yanzm
yanzm / MainActivity.java
Created January 26, 2017 03:03
Customize GridLayoutManager sample
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final RecyclerView recyclerView = new RecyclerView(this);
setContentView(recyclerView);
recyclerView.setHasFixedSize(true);
@dadino
dadino / activity_main.xml
Last active December 26, 2020 19:01
A CoordinatorLayout layout, with a Google Map that collapse itself. A TabLayout (inside the CollapsingToolbarLayout) provides navigation for the ViewPager, that sits just below the AppBarLayout. The FloatingActionButton is used to go to the next page in the ViewPager.
<android.support.design.widget.CoordinatorLayout
android:id="@+id/main_content"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
@daniellevass
daniellevass / android_material_design_colours.xml
Last active March 26, 2024 15:48
Android Material Design Colours
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- google's material design colours from
http://www.google.com/design/spec/style/color.html#color-ui-color-palette -->
<!--reds-->
<color name="md_red_50">#FFEBEE</color>
<color name="md_red_100">#FFCDD2</color>
<color name="md_red_200">#EF9A9A</color>
@cyrilmottier
cyrilmottier / ResourcesAdditions.java
Last active January 12, 2024 17:55
Lightweight key-value pairs resources for Android applications.
package com.cyrilmottier.android.resourcesadditions;
import android.content.res.Resources;
import android.content.res.XmlResourceParser;
import android.os.Bundle;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
/**
* @author Cyril Mottier
@shikajiro
shikajiro / adbscreen.sh
Created November 19, 2013 05:50
Androidで5秒間のデモ動画を撮るときのスクリプト。撮った映像はdropboxの公開フォルダに入れてリンクをクリップボードにコピーします。
echo "start adb shell capture"
DATE=$(date +%Y%m%d%H%M%S)
FILENAME=${DATE}.mp4
DROPBOX_ID=462856
adb shell screenrecord --verbose --time-limit 5 --size 540x960 /sdcard/demo.mp4
adb pull /sdcard/demo.mp4 ~/Dropbox/Public/capture/${FILENAME}
adb shell rm /sdcard/temp.png
DROPBOX_URL=https://dl.dropboxusercontent.com/u/${DROPBOX_ID}/capture/${FILENAME}
@shikajiro
shikajiro / adbscreen.sh
Created November 15, 2013 08:57
1.Androidの画面をキャプチャする。 2.Dropboxのpublicフォルダに入れる 3.その公開URLをクリップボードにコピーする そんなスクリプト。
echo "start adb shell capture"
DATE=$(date +%Y%m%d%H%M%S)
FILENAME=${DATE}.png
DROPBOX_ID=462856
adb shell screencap -p /sdcard/temp.png
adb pull /sdcard/temp.png ~/Dropbox/Public/capture/${FILENAME}
adb shell rm /sdcard/temp.png
DROPBOX_URL=https://dl.dropboxusercontent.com/u/${DROPBOX_ID}/capture/${FILENAME}
/**
* タブの切替毎に必要なFragmentを取得するためのAdapterクラス
*/
public static class SectionsPagerAdapter extends FragmentPagerAdapter {
private final Context mContext;
private final ViewPager mViewPager;
private final ArrayList<TabInfo> mTabs = new ArrayList<TabInfo>();
private static final class TabInfo {
private final Class<?> clazz;
@wate
wate / syntax.md
Last active September 13, 2022 02:26
Markdownで行こう!

Markdownで行こう!

Markdownとは?

Markdownのルールで書かれたテキストはタグなど複雑な要素が用いられていないため
直感的に分かりやすく、HTMLに変換しないままでも配布することが可能です。
Markdownのルールは[Settext][]、[atx][]、[Textile][]、[reStructuredText][]、
[Grutatext][]、[EtTe][]といったテキスト文書をHTMLに変換するツールを参考にしています。