Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Overstreet chrisoverstreet

View GitHub Profile
View activity_fragment.xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.bignerdranch.android.beatbox.BeatBoxActivity">
</FrameLayout>
View SingleFragmentActivity.java
public abstract class SingleFragmentActivity extends AppCompatActivity {
protected abstract Fragment createFragment();
@LayoutRes
protected int getLayoutResId() {
return R.layout.activity_fragment;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
@chrisoverstreet
chrisoverstreet / hex_transparency_values.txt
Created Jun 16, 2017
Android hex transparency values
View hex_transparency_values.txt
100% — FF
95% — F2
90% — E6
85% — D9
80% — CC
75% — BF
70% — B3
65% — A6
60% — 99
55% — 8C
View blank_image_gradient.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<size
android:height="439px"
android:width="780px"/>
<gradient
android:startColor="#000000"
android:endColor="#424242"
android:angle="45"
android:type="linear"/>
View fade_in.xml
<?xml version="1.0" encoding="UTF-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:interpolator="@android:anim/accelerate_interpolator"
android:duration="1000"/>
</set>
View Get sha1 key
keytool -exportcert -list -v \
-alias androiddebugkey -keystore ~/.android/debug.keystore
@chrisoverstreet
chrisoverstreet / keywords.txt
Last active Oct 2, 2017
Ubuntu 16.04 Terminal Keywords
View keywords.txt
gnome-desktop-item-edit --create-new ~/Desktop
# create new desktop launcher
dpkg -L <package name>
# see where a package is installed
chmod 777 <filename>
# change permissions to read, write, execute
chmod -R <permissionsettings> <dirname>
@chrisoverstreet
chrisoverstreet / index.html
Created Oct 17, 2017
Infinite Scroll - Masonry
View index.html
<h1>Infinite Scroll - Masonry image grid</h1>
<div class="grid are-images-unloaded">
<div class="grid__col-sizer"></div>
<div class="grid__gutter-sizer"></div>
<div class="grid__item grid__item--height2"></div>
<div class="grid__item grid__item--width2">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/82/orange-tree.jpg" alt="orange tree" />
</div>
<div class="grid__item grid__item--height3"></div>
@chrisoverstreet
chrisoverstreet / server.js
Created May 23, 2018
Cosmic Blog tutorial - server.js
View server.js
/* eslint-disable no-console */
require('dotenv').config({ path: './.env.production' });
const express = require('express');
const next = require('next');
const routes = require('./routes');
const Cosmic = require('cosmicjs');
const port = parseInt(process.env.PORT, 10) || 3000;
const dev = process.env.NODE_ENV !== 'production';
const app = next({ dev });
@chrisoverstreet
chrisoverstreet / server.js
Created May 23, 2018
Cosmic Blog tutorial - API endpoint for site metadata
View server.js
// API endpoint for site metadata (i.e. title, tag, logo)
server.get('/api/meta', (req, res) => bucket.getObject({ slug: 'header' })
.then(object => res.send(object))
.catch(err => res.status(404).json({
message: 'Error fetching header data',
error: err,
})));
You can’t perform that action at this time.