Skip to content

Instantly share code, notes, and snippets.

View jamesdixon's full-sized avatar

James Dixon jamesdixon

View GitHub Profile
@slightfoot
slightfoot / split_bar.dart
Last active March 8, 2022 14:06
Split Bar in Flutter. Lets you touch between two horizontal sections to resize the split point.
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
void main() {
runApp(
MaterialApp(
theme: ThemeData(
primaryColor: Colors.indigo,
accentColor: Colors.pinkAccent,
),
@agrcrobles
agrcrobles / android_instructions_29.md
Last active October 22, 2023 12:09 — forked from patrickhammond/android_instructions.md
Setup Android SDK on OSX with and without the android studio

Hi, I am a fork from https://gist.github.com/patrickhammond/4ddbe49a67e5eb1b9c03.

A high level overview for what I need to do to get most of an Android environment setup and maintained on OSX higher Catalina and Big Sur with and without Android Studio been installed.

Considering the SDK is installed under /Users/<your_user>/Library/Android/sdk folder which is the Android Studio preferred SDK location, but it works fine under /usr/local/share/android-sdk as well, which is a location pretty much used on CI mostly.

Prerequisites:

https://github.com/shyiko/jabba instead ?

@saschwarz
saschwarz / app.module.ts
Last active March 12, 2018 11:33
Rollbar JS in Angular 4/Typescript
...
import { RollbarService, RollbarErrorHandler, rollbarFactory } from './rollbar';
@NgModule({
...
providers: [
{
provide: ErrorHandler,
useClass: RollbarErrorHandler
},

Raise Open File Limits in OS X

in OS X 10.4 to macOS sierra 10.12 and maybe higher!

Create Launcher Script:

/Library/LaunchDaemons/limit.maxfiles.plist

Copy this entire code block and paste it into your terminal and push Return to create this file for you with correct permissions. It will (probably) ask for your password:

@dongseok0
dongseok0 / azure-storage-promisify.js
Last active February 24, 2020 02:03
Promisify Azure storage service
// Use function that Async keyword appended
Bluebird.promisifyAll(blobService, {
promisifier: (originalFunction) => function (...args) {
return new Promise((resolve, reject) => {
try {
originalFunction.call(this, ...args, (error, result, response) => {
error && reject(error);
resolve({result, response});
});
} catch (e) {
@acgourley
acgourley / gist:9a11ffedd44c414fb4b8
Last active January 21, 2022 06:37
Knex / MySQL Timeout Issue Postmortem

For several weeks our production deployment (Express, Bookshelf/Knex -> MySQL) was randomly having queries fail resulting in 500 errors and server crashes.

The first issue is that the Knex library was using Pool2 slightly incorrectly, and when a ETIMEDOUT error occurred, it tried to release the pooled connection twice. This would create an exception which would crash express (unless you have a top level error handler defined in your express setup)

In this issue (myndzi/pool2#12 (comment)) filed on pool2 by the author of knex (tgriesser) the author of pool2 (myndzi) points out the error handling issue and created a fork of knex with the fix git+https://github.com/myndzi/knex#double-release

After installing the fix on my server, whenever ETIMEDOUT occured an error would be generated in the expected part of the code so that I could decide to retry the query or fail gracefully. Removing the ETIMEDOUT entirely would be

@eliotsykes
eliotsykes / current-route-query-params-ember-component.js
Last active November 13, 2019 13:06
How to get the current route, queryParams, etc. in an Ember component
// Examples
// Yes, "router.router" twice - this assumes that the router is being injected
// into the component. Otherwise lookup 'router:main'
// One of these will be of interest, figure out which one you want:
this.get('router.router.state');
this.get('router.router.state.params');
this.get('container').lookup('controller:application').currentPath;
@ryanlabouve
ryanlabouve / ember-deploy-notes.md
Last active January 27, 2017 09:48
Ember Deploy Notes (s3 and redis)
// Notes from our previous deploy strategy

CI for Ember-CLI App using

Using ember-cli-deploy we will deploy our Ember(-cli) app to S3 (and cloudfront), Redis via github and codeship.

Since skill-set's may vary, set's start by breaking this down at a high level:

@SaladFork
SaladFork / _instructions.md
Last active April 14, 2016 16:52
Mocha Reporter (+blanket.js)
  1. Put reporter.js in tests/helpers/reporter.js
  2. Change tests/test-helper.js to look like the attached
  3. Put test-container-styles.css in vendor/ember-cli-mocha to override the default
  4. Stop your server and restart (it doesn't watch vendor/ by default)
@rhys-vdw
rhys-vdw / paginate.coffee
Last active March 8, 2016 16:07
Poor man's knex/bookshelf pagination
Promise = require 'bluebird'
defaultPageSize = 20
paginate = (knex) -> (query, paginationOptions, options) ->
if query.fetchAll?
model = query
query = model.query()