Skip to content

Instantly share code, notes, and snippets.

@farmisen
farmisen / nvmrc.md
Last active April 8, 2018 23:47
autoselect node version when enter directory

To have a specific node version used ped project add the following to you ~/.profile and create a .nvmrc file with the node version at the root of the project.

enter_directory() {
  if [[ $PWD == $PREV_PWD ]]; then
    return
  fi

 PREV_PWD=$PWD
@farmisen
farmisen / gist:1d30c5e639977434d93e853c7891e415
Last active January 31, 2018 19:36 — forked from giannisp/gist:ebaca117ac9e44231421f04e7796d5ca
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
After automatically updating Postgres to 10.1 via Homebrew, the pg_ctl start command didn't work.
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.1."
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install [email protected]
brew unlink [email protected]
brew link postgresql
@farmisen
farmisen / index.js
Last active August 13, 2016 23:58
upload file to gcloud
// Install the gcloud CLI from https://cloud.google.com/sdk/downloads
// then login by doing gcloud auth login [email protected]
import fs from 'fs'
...
.use('/test', async(ctx, next) => {
console.log("IN TEST!")
const CLOUD_BUCKET = 'occamzrazor';
[user]
email = YOUR EMAIL
name = YOU NAME
[branch]
autosetuprebase = always
[commit]
template = /Users/YOUR HOME DIRECTORY NAME/.gitmessage.txt
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
Request:
PUT /documents/102842/escalate HTTP/1.1
Host: spark.stg.circleone.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0
Accept: application/json, text/javascript, */*; q=0.01
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
X-CSRF-Token: 7bAOu9aO+qXXPpZaX1hpSrOze7W2bT7Vbwvsmv/tEkE=
Content-Type: application/json; charset=UTF-8
X-Requested-With: XMLHttpRequest
@farmisen
farmisen / devise.rb
Created August 28, 2014 21:17 — forked from elarex/devise.rb
Devise.setup do |config|
config.mailer_sender = "[email protected]"
require 'devise/orm/active_record'
config.case_insensitive_keys = [ :email ]
config.strip_whitespace_keys = [ :email ]
config.skip_session_storage = [:http_auth]
config.stretches = Rails.env.test? ? 1 : 10
config.reconfirmable = true
config.password_length = 8..128
config.reset_password_within = 6.hours
module Devise
module Models
module RemoteAuthenticatable
extend ActiveSupport::Concern
#
# Here you do the request to the external webservice
#
# If the authentication is successful you should return
# a resource instance
# Installing Chrome
curl -L -O "https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg"
hdiutil mount -nobrowse googlechrome.dmg
cp -R "/Volumes/Google Chrome/Google Chrome.app" /Applications
hdiutil unmount "/Volumes/Google Chrome"
rm googlechrome.dmg
# Installing Firefox
curl -L -o Firefox.dmg "http://download.mozilla.org/?product=firefox-latest&os=osx&lang=en-US"
hdiutil mount -nobrowse Firefox.dmg
//
// WAFirstViewController.m
// WeatherApp
//
// Created by demo on 7/23/13.
// Copyright (c) 2013 Mohit Sadhu. All rights reserved.
//
#import "WACurrentLocationViewController.h"
#import "YOSSocial.h"
category->level = level;
needFlush = true;
int learnerId = [[[[LearnerCoordinator sharedInstance] currentLearner] learnerId] intValue];
NSString *key = [NSString stringWithFormat:@"learning_model.%d.%s.%s.dimension", learnerId, _currentGame->name.c_str(), name.c_str()];
// NSString *key = [NSString stringWithFormat:@"learning_model.%s.%s.dimension", _currentGame->name.c_str(), name.c_str()];
CCUserDefault::sharedUserDefault()->setIntegerForKey([key UTF8String], level);