Skip to content

Instantly share code, notes, and snippets.

LOGFILE="$HOME/Desktop/xcode-pre-action.txt" ;
print_pwd () { echo "pwd: $(pwd)" >> $LOGFILE ; }
bump_version () { agvtool bump ; }
echo "" > $LOGFILE ;
echo "Build Pre-Action" >> $LOGFILE
print_pwd ;
echo "PROJECT_DIR: $PROJECT_DIR" >> $LOGFILE ;
echo "cd into project directory" >> $LOGFILE ;
@sch
sch / Main.elm
Last active January 30, 2019 16:35
Minimum Elm boilerplate
module Main exposing (main)
import Browser
import Html exposing (Html, button, div, text)
import Html.Events exposing (onClick)
type alias Model =
{ count : Int }
@vampaynani
vampaynani / redux.js
Created May 9, 2018 16:36
How does redux store works behind the scenes
/*
* reducers/user.js
*/
const userInitialState = {
authToken: null,
userId: null
}
const userReducer = (state = userInitialState, action)=>{
return state;
}
@vrymel
vrymel / rename_phoenix_project.sh
Created September 9, 2017 09:14
Command steps to rename a Phoenix project
# tested on macOS 10.12.4
# based on https://elixirforum.com/t/how-to-change-a-phoenix-project-name-smoothly/1217/6
# replace values as necessary
current_otp="hello_phoenix"
current_name="HelloPhoenix"
new_otp=""
new_name=""
git grep -l $current_otp | xargs sed -i '' -e 's/'$current_otp'/'$new_otp'/g'
@jbeda
jbeda / manifest-template.yaml
Created October 23, 2014 22:28
Script to create VM to host private docker registry on GCE backed by GCS
# Copyright 2014 Google Inc. All rights reserved.
#
# 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
# distributed under the License is distributed on an "AS IS" BASIS,
@xiaom
xiaom / install_mosh_locally.sh
Last active April 2, 2024 16:48
install mosh locally
#!/bin/sh
# this script does absolutely ZERO error checking. however, it worked
# for me on a RHEL 6.3 machine on 2012-08-08. clearly, the version numbers
# and/or URLs should be made variables. cheers, zmil...@cs.wisc.edu
mkdir mosh
cd mosh
collection = [:a, :b, :c]
collection.each_with_index.each_with_object({}) do |(item, index), hash|
hash[item] = index
end
# => {:a=>0, :b=>1, :c=>2}
@aiwilliams
aiwilliams / api_helpers_warden.rb
Last active December 15, 2015 00:39
Using Warden and Grape? You'll need some code to configure the Warden::Manager and install the Warden::Proxy in the Rack env. For Rails, this is typically done using Devise or rails_warden, and then you'll need some helper methods in your Grape::API, similar to those found in http://github.com/hassox/rails_warden/blob/master/lib/rails_warden/con…
# Provide access to the Warden::Proxy in the Rack env by including this module in your Grape::API:
#
# helpers Api::Helpers::Warden
#
# These methods require that something has configured the Warden::Manager, and
# the upstream middleware is in place to make the Warden::Proxy exist in the
# env! In a Rails app, this is typically done by Devise or rails_warden.
#
module Api::Helpers::Warden
@originalhat
originalhat / brew-install-openssl-error-13.md
Last active March 27, 2022 00:38
make: *** [install_sw] Error 13, "brew install openssl"

Mo SSL, Mo Problems

Problem

$ brew install openssl
==> Downloading http://openssl.org/source/openssl-1.0.1e.tar.gz
Already downloaded: /Library/Caches/Homebrew/openssl-1.0.1e.tar.gz
==> perl ./Configure --prefix=/usr/local/Cellar/openssl/1.0.1e --openssldir=/usr/local/etc/openssl zlib-dynamic shared darwin64-x86_64-cc
==> make
@semipermeable
semipermeable / data_migration_and_test.rb
Created July 14, 2011 19:18
Rails3 Data Migration and RSpec Test
# db/migrate/20110714024435_split_author.rb
class SplitAuthor < ActiveRecord::Migration
def self.up
Post.where(:author=>nil).each do |p|
author = Author.create!(:name => p.author_name,
:account_id => p.account_id)
p.author = author
p.save!
end
end