Skip to content

Instantly share code, notes, and snippets.

View MyklClason's full-sized avatar

Mykl Clason MyklClason

  • Wisconsin, United States
View GitHub Profile
@MyklClason
MyklClason / a-piece-of-pi.py
Last active January 17, 2016 02:18
Old math joke: A piece of pi (Python)
import random
import math
# Ideally, this would return x such that, 0 < x < pi
# For use in cases where you need to calculate things like,
# the "sum of the square root, minus a piece of pi"
# (it's less amusing if I give the source, Google is your friend)
def a_piece_of_pi():
return random.random(0,math.pi)
@MyklClason
MyklClason / db-hard-reset
Last active March 18, 2016 22:05
Rails: Run from console if migrations are changed (avoid doing this)
rake db:drop db:create db:migrate db:schema:dump db:setup
@MyklClason
MyklClason / useful_rails_gems.md
Last active September 12, 2017 07:37
List of useful gems and related articles I've come across.

Notes for those who are reading this:

  • Blocks are generally used together.
  • Feel free to suggest addition gems or articles to be added.
  • I may eventually make this into a repo.
  • At the bottom is a list of things pending review that others may find useful.
@MyklClason
MyklClason / Fast Command Line.bat
Last active February 23, 2016 01:35
Pull up the command line set to folder file is in
# This is a code snippet I found online. Placed here for ease of access.
# Doubling clicking on this file pulls up the command line with the
# directory set to the same as the folder holding this file.
@ECHO OFF
cmd.exe /K
@MyklClason
MyklClason / 0_reuse_code.js
Created February 16, 2016 19:25
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@MyklClason
MyklClason / Delete Branches
Last active February 24, 2016 02:59
Delete all local branches
# Safer delete all
git branch | grep -v "master" | xargs git branch -d
# Delete all
# Source: https://coderwall.com/p/x3jmig/remove-all-your-local-git-branches-but-keep-master
git branch | grep -v "master" | xargs git branch -D
@MyklClason
MyklClason / 0.rails-repo-setup.md
Last active October 15, 2016 05:26
Reminder for how to setup my typical rails app to ensure nothing gets forgotten. Includes a number of useful files. Uses Devise, Bootstrap, Rspec, Capybara, and Guard.

Instructions:

  1. Setup rails:
    • rails new app-name
    • rails new app-name -T (if going to use rSpec)
  2. UpdateGemfile
  3. Run Bundle install --without production
  4. Create Guardfile
  5. Run rails generate rspec:install
  6. Update spec/rails_helper.rb
@MyklClason
MyklClason / readme.md
Last active February 11, 2024 15:06
List of useful terminal bash aliases for Ruby On Rails, Cloud9, Git and more. What are bash aliases: http://www.tldp.org/LDP/abs/html/aliases.html What does && and ; do? http://unix.stackexchange.com/a/304258
@MyklClason
MyklClason / import.html.erb
Created April 10, 2016 21:47
View for imported data, where @sheet is a sheet created by the Roo Gem)
<table class="table table-hover">
<% @sheet.each do |row| %>
<tr>
<% row.each do |data| %>
<td><%= data %></td>
<% end %>
</tr>
<% end %>
</table>