Skip to content

Instantly share code, notes, and snippets.

View bitclaw's full-sized avatar

Bitclaw bitclaw

View GitHub Profile
@bitclaw
bitclaw / git.migrate
Last active November 16, 2016 14:24
Migrate Github repository to Bitbucket
git clone --mirror git@github.com:user/name-of-repo.git
git remote add bitbucket git@bitbucket.org:name-of-repo/name-of-repo.git
git push bitbucket --mirror
@bitclaw
bitclaw / bluehost-composer.sh
Last active November 18, 2016 07:17
Configure Bluehost composer
mkdir ~/common
cd ~/common
curl -sS https://getcomposer.org/installer | /usr/php/56/bin/php
# Add in .bashrc
echo "alias composer='/usr/php/56/bin/php ~/common/composer.phar'" >> ~/.bashrc
source ~/.bashrc
# .bashrc
# User specific aliases and functions
alias mv='mv -i'
alias rm='rm -i'
alias cp='cp -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
# Use PHPBETACGI as default
AddHandler fcgidbeta-script .php
# BlueHost.com
# .htaccess main domain to subdirectory redirect
# Do not change this line.
RewriteEngine on
# Change example.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?testdomain.org$
# Change 'subdirectory' to be the directory you will use for your main domain.
@bitclaw
bitclaw / mongo-queries.js
Last active November 21, 2016 14:10
MongoDB Queries
// Get record by subobject
db.protocol.find({"study.official_title": "TEST"})
db.protocol.find({"study.official_title": "TEST"},{"events": 1})
@bitclaw
bitclaw / 0. intro.md
Created January 15, 2017 16:50 — forked from jquense/0. intro.md
Alternative ways to define react Components

The 0.13.0 improvements to React Components are often framed as "es6 classes" but being able to use the new class syntax isn't really the big change. The main thing of note in 0.13 is that React Components are no longer special objects that need to be created using a specific method (createClass()). One of the benefits of this change is that you can use the es6 class syntax, but also tons of other patterns work as well!

Below are a few examples creating React components that all work as expected using a bunch of JS object creation patterns (https://github.com/getify/You-Dont-Know-JS/blob/master/this%20&%20object%20prototypes/ch4.md#mixins). All of the examples are of stateful components, and so need to delegate to React.Component for setState(), but if you have stateless components each patterns tends to get even simpler. The one major caveat with react components is that you need to assign props and context to the component instance otherwise the component will be static. The reason is

Keybase proof

I hereby claim:

  • I am bitclaw on github.
  • I am bitclaw (https://keybase.io/bitclaw) on keybase.
  • I have a public key whose fingerprint is C1B5 1958 F8F8 DB11 B166 8802 9AFA 07FA 6E94 5570

To claim this, I am signing this object:

@bitclaw
bitclaw / webstorm64.vmoptions
Last active March 5, 2023 11:14
Jetbrains Custom VM Options Optimized Configuration: Performance tuning parameters for IntelliJ IDEA. Add these params in idea64.exe.vmoptions or idea.exe.vmoptions file in IntelliJ IDEA. If you are using JDK 8.x, please knock off PermSize and MaxPermSize parameters from the tuning configuration.
# custom WebStorm VM options, this configuration also works well for other IDEs like phpstorm, pycharm..etc.
-Xms1024m
-Xmx2048m
-XX:ReservedCodeCacheSize=240m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
@bitclaw
bitclaw / useful_git_commands.txt
Last active June 8, 2017 14:51
useful git commands
git rebase -i HEAD~n (Where n is the number of commits, useful for squashing several meaningless commits into one)
git push -f
Useful links:
https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request
@bitclaw
bitclaw / GIT-CHEATSHEET.md
Last active March 26, 2019 08:44
GIT CHEATSHEET

Using Git

The "Oh crap I didn't mean to commit yet" Trick

# undo last commit and bring changes back into staging (i.e. reset to the commit one before HEAD)
$ git reset --soft HEAD^