Skip to content

Instantly share code, notes, and snippets.

/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "AppDelegate.h"
class Storage {
constructor(dbName, remoteDbUrl) {
this.dbName = dbName
this.remoteDbUrl = remoteDbUrl;
}
init() {
this.database = new manager(`http://127.0.0.1:5984/`, this.dbName);
return this.database.createDatabase().then(res => {
'use strict';
import {manager, ReactCBLite} from 'react-native-couchbase-lite';
import EventEmitter from 'EventEmitter';
export const CHANGE_EVENT_TYPE = 'change';
const ERROR_EVENT_TYPE = 'error';
const DB_NAME = 'db'; //'user_123';
const DB_LOCAL_USER_NAME = 'admin';
const DB_LOCAL_PASSWORD = 'password';
@blairio
blairio / blah.jsx
Last active January 14, 2016 18:55
export default class MerchCoReports extends React.Component {
constructor(serverProps, context) {
super(serverProps, context);
this.state = {loggedIn: true, name: 'Bill'}
}
onLoggOutClicked = (e) => {
this.setState({loggedIn:false})
}
/*
* Copyright (C) 2014 sebnapi
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@blairio
blairio / heroku.rake
Created September 3, 2013 20:08
Rake tasks for cutting a branch and deploying to a Heroku target. This works best when you have the Heroku Labs "preboot" feature enabled. Primarily, this is for deploys that do not have migrations. Migration deploys is still a work in progress and depends on the contents of the migration. (See http://pedro.herokuapp.com/past/2011/7/13/rails_mig…
def migrate_db(remote)
# sh %{heroku maintenance:on --remote #{remote}} || fail
sh %{heroku run --remote #{remote} bundle exec rake db:migrate} || fail
# sh %{heroku maintenance:off --remote #{remote}} || fail
end
def zero_deploy(environment, remote, branch)
original_path = pwd
deploy_name = "#{environment}_#{Time.now.strftime("%Y-%m-%d-%H-%M")}"
puts "-> bundle exec rake deploy:monitor[#{deploy_name}]"
@blairio
blairio / put_in_application.rb
Last active December 17, 2015 21:59
Logging with log level and Process id. $$ is the pid Put simple_formatter in config/initializers Apparently for Unicorn on Heroku apps you are supposed to add put_in_application to application.rb within class Application < Rails::Application
if Rails.env[/production|staging/]
config.logger = Logger.new(STDOUT)
config.logger.level = Logger.const_get(ENV['LOG_LEVEL'] ? ENV['LOG_LEVEL'].upcase : 'INFO')
end