Skip to content

Instantly share code, notes, and snippets.

Kyle Tolle kyletolle

Block or report user

Report or block kyletolle

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mikepack
mikepack / 1_inheritance.rb
Last active Aug 29, 2015
5 Composition Techniques
View 1_inheritance.rb
class Animal
def run
puts 'running'
end
end
Animal.new.run #=> running
class Wolf < Animal
def follow_pack
View rspec_cheatsheet_controller_spec.rb
require 'rails_helper'
RSpec.describe TodosController, :type => :controller do
describe "GET #index" do
#describe "POST #create" do
#describe "GET #show" do
#describe "PATCH #update" do (or PUT #update)
#describe "DELETE #destroy" do
#describe "GET #new" do
@krisbulman
krisbulman / countCSSRules.js
Last active Feb 6, 2019 — forked from psebborn/countCSSRules.js
Count the number of rules and selectors for CSS files on the page. Flags up the >4096 threshold that confuses IE. — This snippet has been modified to count more than just the first level of CSSStyleRule objects within CSSMediaRule.
View countCSSRules.js
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
View gist:625742da4ec0a64584ed
irb(main):002:0> require 'bigdecimal'
=> true
irb(main):003:0> v = BigDecimal("7.1762")
=> #<BigDecimal:7f8905213dc0,'0.71762E1',18(18)>
irb(main):004:0> v.truncate(2).to_s('F')
=> "7.17"
irb(main):005:0> w = BigDecimal("4.2")
=> #<BigDecimal:7f890522c5f0,'0.42E1',18(18)>
irb(main):006:0> w.truncate(2).to_s('F')
=> "4.2"
View gist:9939366
RubyProf.start
# Code to profile...
result = RubyProf.stop
# Print a graph to an HTML file, sorted by time spend in children.
File.open('profile_output.html', 'w') do |file|
printer = RubyProf::GraphHtmlPrinter.new result
printer.print(file, sort_method: :children_time)
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active Nov 15, 2019
how to delete a git tag locally and remote
View git-tag-delete-local-and-remote.sh
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@kristopherjohnson
kristopherjohnson / Makefile
Last active Oct 26, 2019
Makefile that uses Pandoc to generate HTML, PDF, DOCX, etc. from Markdown source files
View Makefile
# Makefile
#
# Converts Markdown to other formats (HTML, PDF, DOCX, RTF, ODT, EPUB) using Pandoc
# <http://johnmacfarlane.net/pandoc/>
#
# Run "make" (or "make all") to convert to all other formats
#
# Run "make clean" to delete converted files
# Convert all files in this directory that have a .md suffix
@vzvenyach
vzvenyach / docx2md.md
Last active Oct 20, 2019
Convert a Word Document into MD
View docx2md.md

Converting a Word Document to Markdown in Two Moves

The Problem

A lot of important government documents are created and saved in Microsoft Word (*.docx). But Microsoft Word is a proprietary format, and it's not really useful for presenting documents on the web. So, I wanted to find a way to convert a .docx file into markdown.

The Solution

As it turns out, there are several open-source tools that allow for conversion between file types. Pandoc is one of them, and it's powerful. In fact, pandoc's website says "If you need to convert files from one markup format into another, pandoc is your swiss-army knife." But, although pandoc can convert from markdown into .docx, it doesn't work in the other direction.

@benbalter
benbalter / gist.md
Last active Aug 26, 2019
Example of how to embed a Gist on GitHub Pages using Jekyll.
View gist.md

Here's an example of how to embed a Gist on GitHub Pages:

{% gist 5555251 %}

All you need to do is copy and paste the Gist's ID from the URL (here 5555251), and add it to a gist tag surrounded by {% and %}.

@a1phanumeric
a1phanumeric / gist:5346170
Created Apr 9, 2013
Grep exclusions. Demonstrates how to exclude multiple directories, and files.
View gist:5346170
grep -r --color --exclude-dir={custom,lib,scripts} --exclude={*.xml,error_log} "beta" .
You can’t perform that action at this time.