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 / 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 / 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 / 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 / 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 / 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>
@MyklClason
MyklClason / audit.yml
Last active April 18, 2016 04:39
rails-audit
Rubocop:
#Parameters: '-D -E --auto-gen-config --auto-correct'
Parameters: '-D -E --auto-gen-config'
Breakman:
Parameters: '-A -q --summary'
Cane:
Parameters: ''
@MyklClason
MyklClason / geolocation-demo.html
Created April 25, 2016 18:46
geolocation use demo
<div id="demo"></div>
<button onclick="getLocation()">Click to show location</button>
<script>
var x = document.getElementById("demo");
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
@MyklClason
MyklClason / useful-heroku-addons.md
Last active May 24, 2016 13:05
(Potentially) Useful Heroku Addons (Focused on Ruby Apps)
  • AppSignal: Improve performance, debug errors and track deploys for your Ruby on Rails apps
  • Honeybadger: Modern error management and performance monitoring for web applications
  • Informant: Usability monitoring for Ruby on Rails.
  • Raygun: Real time error reporting you can set up in under 5 minutes!
  • Keen IO: Analytics for Developers
  • DbInsights: Business intelligence insights and analytics from your database
  • IronWorker: Highly available and scalable task queue / worker service.
    • Free version seems only suitable for very small scale tasks. Better to use Que if scheduled size expected to exceed 5.
  • QuotaGuard: Proxy Your API