Skip to content

Instantly share code, notes, and snippets.

@mattratleph
mattratleph / vimdiff.md
Last active May 9, 2024 03:11 — forked from roothybrid7/vimdiff_cheet.md
vimdiff cheat sheet

vimdiff cheat sheet

##git mergetool

In the middle file (future merged file), you can navigate between conflicts with ]c and [c.

Choose which version you want to keep with :diffget //2 or :diffget //3 (the //2 and //3 are unique identifiers for the target/master copy and the merge/branch copy file names).

:diffupdate (to remove leftover spacing issues)

:only (once you’re done reviewing all conflicts, this shows only the middle/merged file)

@wrburgess
wrburgess / README.md
Created January 28, 2013 21:41
Spree: Skipping delivery step, but adding back default shipping method and tax calculation

Objective: Skip the delivery step in the Checkout state machine and bring back the ability to add a default shipping method and tax calculation

Approach: Add decorators to the Checkout controller and the Order model (see attached files)

Note: This approach might be better managed by overriding the self.define_state_machine! method of the Checkout model located at app/models/spree/order/checkout.rb. However, this model is rather unstable in the Spree upgrade path and overriding the above classes seems to be simpler to adjust.

@eprothro
eprothro / communication via narrative.md
Last active January 4, 2023 16:58
Connextra, Gherkin, and Free-form prose for multidisciplinary communication via narrative.

Overview

Getting clients, managers, project managers, designers, and developers on the same page when it comes to feature expectations is hard. Everyone speaking the same language (literally) can go a long way to achieving the same, metaphorically.

There are three common formats that are great for written and verbal communication between stakeholders with different backgrounds, responsibilities, and risk exposures. They are each natural-language, narrative formats (they use plain english) that anyone can understand, but their structrued nature is proven to help clearly communicate behavior, specify intent and synchronize expectations.

Connextra user stories

  • Great for high level feature description
  • Typically bad for detailed behavior description
@chischaschos
chischaschos / shortest_path_spec.rb
Created October 29, 2013 22:26
dijkstra shortest path in ruby
require 'spec_helper'
SP = ->(graph, from_node, to_node, nodes = Hash.new(0), visited = [], i = 0) {
return nodes[from_node] if from_node == to_node
neighbours = graph[from_node].reject {|k, v| visited.include?(k) }
neighbours.each do |k, v|
if nodes[k] == 0 || nodes[from_node] + v < nodes[k]
nodes[k] = nodes[from_node] + v
@rxaviers
rxaviers / gist:7360908
Last active June 2, 2024 04:38
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@JoshCheek
JoshCheek / option_parser_example.rb
Created February 8, 2015 09:27
Why I will not use Ruby's OptionParser
# Have to hijack the global environment, b/c that's how invasive it is!
def self.wtf
to_return = {exception: nil, stdout: nil, stderr: nil}
require 'stringio'
$stdout = StringIO.new
$stderr = StringIO.new
to_return[:returned] = yield
rescue Exception
to_return[:exception] = $!
ensure
@loceee
loceee / AdwareExt.py
Last active September 29, 2016 05:20
AdwareRemover - thanks shea
#!/usr/bin/python
"""Identify or remove files known to be involved in Adware/Malware
infection.
Most of the code applies to building a list of malware files. Thus,
both extension attribute and removal handling are included.
Cleans files as a Casper script policy; thus, it expects four total
arguments, the first three of which it doesn't use, followed by
--remove
@zlargon
zlargon / remove_malware.sh
Last active February 15, 2017 15:08
Remove unwanted adware that displays pop-up ads and graphics on your Mac. https://support.apple.com/en-us/HT203987
#!/bin/bash
echo "Remove unwanted adware that displays pop-up ads and graphics on your Mac"
echo "https://support.apple.com/en-us/HT203987"
echo ""
# 1. Downlite, VSearch, Conduit, Trovi, MyBrand, Search Protect, Buca Apps
echo "1. Remove Downlite, VSearch, Conduit, Trovi, MyBrand, Search Protect, Buca Apps"
echo ""
malware[0]="/System/Library/Frameworks/v.framework"
malware[1]="/System/Library/Frameworks/VSearch.framework"
@benlinton
benlinton / multiple_mysql_versions_for_development.md
Last active September 23, 2023 09:38
Multiple MySQL Versions with Homebrew

Multiple MySQL Versions for Development

Options included below:

  • Using Docker docker-compose
  • Using Homebrew brew

Using Docker (recommended)

This gist was originally created for Homebrew before the rise of Docker, yet it may be best to avoid installing mysql via brew any longer. Instead consider adding a barebones docker-compose.yml for each project and run docker-compose up to start each project's mysql service.

@yang-wei
yang-wei / destructuring.md
Last active February 20, 2024 04:40
Elm Destructuring (or Pattern Matching) cheatsheet

Should be work with 0.18

Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !

Tuple

myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))