Skip to content

Instantly share code, notes, and snippets.

View christopherfujino's full-sized avatar
💻
Maybe coding

Christopher Fujino christopherfujino

💻
Maybe coding
View GitHub Profile

Flutter Attach

Overview

A Flutter-command that attaches to applications that have been launched without flutter run.

With an application already running, a HotRunner can be attached to it with:

@christopherfujino
christopherfujino / drive_test_stacktrace
Created April 11, 2019 21:46
drive test stacktrace
~/git/flutter/packages/flutter_tools$ pub run test test/commands/drive_test.dart
00:05 +14: drive restore AppStarter --no-build
about to fail...
DriveCommand
Failed assertion: boolean expression must not be null
#0 _startApp (package:flutter_tools/src/commands/drive.dart)
<asynchronous suspension>
#1 DriveCommand.runCommand (package:flutter_tools/src/commands/drive.dart:133:51)
<asynchronous suspension>
#2 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:559:18)

Jekyll: Static-Site Generator

With Jekyll, you can create a blog (or other site) out of static pages. What that means is that it doesn't have a database. Usually with a blog, you would store all of your posts in a database, and when a user goes to view the blog, the server would read the posts from the database and serve them to the user. With Jekyll, each time you write a new post, the entire website is re-built as static web pages, so that all the server has to do is serve the pre-built pages.

The advantage of building a static website is that there is less load on the server--all it has to do is give users the completed page they requested. These pages load lightning-fast, and they can be served to many users simultaneously. In addition, they can be hosted for free on platforms like Github Pages and Netlify.

With Jekyll, posts are written in markdown and compiled to HTML, making writing posts simple and the

@christopherfujino
christopherfujino / slack-ruby-gem.md
Last active August 30, 2017 18:17
Slack-api Gem

The slack-api provides a Ruby wrapper around the slack bot API. It can be installed with gem install slack-api. It is then included in Ruby applications as simply require "slack".

In order to access a slack team, you must first create a bot for your team through the Slack web app, and obtain a unique token associated with the team.

Here is sample code for a basic bot that logs each message that it receives to the terminal:

require "slack"
@christopherfujino
christopherfujino / array-assoc.md
Last active August 17, 2017 15:34
How to use Ruby's array.assoc method.

array.assoc(obj) => array or nil

The assoc method for Ruby arrays takes a single argument and searches for the matching element that is an array whose first element matches the argument. It then returns either the matching sub-array or nil if none was found.

This is a fairly common task in situations where a hash is used to collect a set of data and the keys are used as unique identifiers. I chose this method because I am tired of writing some form of the same basic function in JavaScript:

let beardLengths = [
  {name: 'cory', length: 5},
  {name: 'justin', length: 4}