Skip to content

Instantly share code, notes, and snippets.

@cball
cball / README.md
Last active October 30, 2020 18:30
Example README generated from Bison (https://github.com/echobind/bisonapp)

My Cool Bison App

CI STATUS

Getting Started Tutorial

This checklist and mini-tutorial will make sure you make the most of your shiny new Bison app.

Migrate your database and start the dev server

  • Run yarn db:migrate to prep and migrate your local database. If this fails, make sure you have Postgres running and the generated DATABASE_URL values are correct in your .env files.
@cball
cball / Button.tsx
Created September 11, 2018 19:47
Recommended css-in-js pattern
// src/components/Button/Button.tsx
import React, { SFC } from "react";
import styles from '../styles';
export type Props = {
buttonType: 'primary' | 'secondary'
className?: string;
style?: React.CSSProperties;
} & React.HTMLProps<HTMLButtonElement>;
@cball
cball / Fastfile.rb
Last active April 13, 2024 21:04
Fastlane file for updating ids, display names, and icons w/ badges in React Native
# this should be the folder name under `ios` for your project
project_name = 'MyProject'
# NOTE: This is meant to be run on CI where it changes everything before building the app.
# Usage:
# `RN_RELEASE_TYPE=beta fastlane prep_release_type` (on CI these ENV variables should be set via the UI)
# Available release types: alpha, beta, production (default)
#
# If you're trying this script out locally, make sure you have ImageMagick installed, and discard the changes via git when you're done.
desc "Updates the app identifier, display name and icon for alpha, beta, and production releases"
@cball
cball / ApplicationStyles.js
Last active November 23, 2017 16:39
Example of app-wide fullScreen style and StyleSheet's built-in absoluteFillObject that does the same thing
// App/Theme/ApplicationStyles.js
export default {
fullScreen: {
position: 'absolute',
top: 0,
bottom: 0,
left: 0,
right: 0
}
@cball
cball / AppDelegate.m
Created November 22, 2017 20:59
Snippet to output all font names on launch on iOS
// add below this line:
// - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
// {
// NSURL *jsCodeLocation;
for (NSString* family in [UIFont familyNames])
{
NSLog(@"%@", family);
for (NSString* name in [UIFont fontNamesForFamilyName: family])
{

Keybase proof

I hereby claim:

  • I am cball on github.
  • I am cball (https://keybase.io/cball) on keybase.
  • I have a public key ASAzykLPrkOr317kbFVOyZDqYVKYZ3skb30y_-4U5zV5mQo

To claim this, I am signing this object:

import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
appNameFoo: Ember.computed('appName', {
get() {
return this.get('appName') + ' foo';
}
}),
appNameBar: Ember.computed('appName', function() {
@cball
cball / App.js
Created February 20, 2017 19:31
An example of calling the same code from index.android.js and index.ios.js
import React, { Component } from 'react';
import { View, Text } from 'react-native';
class App extends Component {
render () {
return (
<View>
<Text>App here</Text>
</View>
)
@cball
cball / __name__.js
Last active April 21, 2023 17:13
Ember blueprint to automatically generate related mirage files when you generate a model
import DS from 'ember-data';
export default DS.Model.extend({
<%= attrs.length ? ' ' + attrs : '' %>
});
@cball
cball / user-should-something.js
Created August 18, 2016 16:30
Default ember-cli-mocha acceptance test blueprint
// tests/acceptance/user-should-something.js
import {
describe,
it,
beforeEach,
afterEach
} from 'mocha';
import { expect } from 'chai';
import startApp from '../helpers/start-app';
import destroyApp from '../helpers/destroy-app';