Skip to content

Instantly share code, notes, and snippets.

Avatar
🙅‍♀️
permanent omnishambles

Robin Howard damncabbage

🙅‍♀️
permanent omnishambles
View GitHub Profile
@amysimmons
amysimmons / js-tricky-bits.md
Last active Nov 16, 2021
Understanding closures, callbacks and promises in JavaScript
View js-tricky-bits.md

#Understanding closures, callbacks and promises

For a code newbie like myself, callbacks, closures and promises are scary JavaScript concepts.

10 months into my full-time dev career, and I would struggle to explain these words to a peer.

So I decided it was time to face my fears, and try to get my head around each concept.

Here are the notes from my initial reading. I'll continue to refine them as my understanding improves.

@MadeByMike
MadeByMike / highlight-words-in-html.js
Last active Feb 15, 2018
Highlighting a sentence in HTML without destroying the markup around it is exceptionally hard!!!
View highlight-words-in-html.js
/*!
* Highlight words in html - v0.0.1 - 2015-04-29
* http://madebymike.com.au
* Copyright (c) 2015 Mike Riethmuller; Licensed MIT
*/
/*
* It turns out that annotating a phrase within HTML is exceptionally hard. I've done it so you don't have to.
* The function accepts a phrase (string), HTML (string), and optionally a classname (string)
* It returns the same HTML with <mark> elements surrounding the phrase
View rubocop.rb
#!/usr/bin/env ruby
changed = `git diff --numstat origin/master | awk '{ print $3 }' | grep -E '(\\.rb|\\.rake)$' | grep -v db/schema`
changed = changed.split("\n").select { |c| File.exist?(c) }
if changed.length > 0
system "bundle exec rubocop #{ARGV.join(' ')} #{changed.join(' ')}"
else
puts "No changes."
View job_2014_07.md

Hi!

We're looking for a junior to mid level Javascript and/or Ruby developer to join our team at The Exchange Group.

The Exchange Group is best known for online bike marketplace, bikeexchange.com.au, which in the last couple of years has expanded to New Zealand and Germany. We've also added tinitrader.com.au, renoexchange.com.au and furnitureexchange.com.au to the mix.

The application is primarily Ruby on Rails 3.2, which we're planning on upgrading to 4.0 in the near future. We've brought in AngularJS to several sections of the site already: our new search is entirely Angular. As our application grows, we'll be reducing our reliance on a monolithic Rails application and splitting things into UI & API implementations; this is where you'll come in.

The successful applicant will:

@gelisam
gelisam / UnderstandingPipes.md
Last active May 16, 2019
Understanding the Pipes library
View UnderstandingPipes.md

In response to this reddit post about failing to understand the Pipes library after a couple of hours. I wanted to show how an experienced haskeller does it, but I'm afraid it also took me quite a few hours, which is why the following list of steps goes on and on.

After all those hours, my opinion is that Pipes is not at all an easy library. I don't know if Conduit is any easier, but otherwise I side with your friend in advising to use something else (perhaps ordinary lazy IO?) instead of Pipes.

Anyway, here is the full brain dump of my steps as I tried to get your three snippets to fit together.

  • Since you say that you have a hard time combining the snippets, I assume that they must have complicated types. So my first goal is to figure out the type of your first snippet.
  • hoogle for parseUrl, withManager, etc. No results.
  • Google for haskell runEffect, find that it's a method from Pipes.Core,
@lyoshenka
lyoshenka / ngrok-selfhosting-setup.md
Last active Nov 19, 2021
How to setup Ngrok with a self-signed SSL cert
View ngrok-selfhosting-setup.md

Intro

The plan is to create a pair of executables (ngrok and ngrokd) that are connected with a self-signed SSL cert. Since the client and server executables are paired, you won't be able to use any other ngrok to connect to this ngrokd, and vice versa.

DNS

Add two DNS records: one for the base domain and one for the wildcard domain. For example, if your base domain is domain.com, you'll need a record for that and for *.domain.com.

Different Operating Systems

View belongs_to_lambda.md

An ActiveRecord conundrum

I'm going to describe a weird problem I faced when using ActiveRecord today. To protect the innocent, I'm not going to talk about the app I'm actually working on but will instead discuss a hypothetical but isomorphic database design for a clone of the popular blogging platform Tumblr.

Tumblr lets you publish various different sorts of content. We might be tempted to shove all these types in a big STI table, but the types are all quite different from one another and so we give them their own tables.

@glv
glv / experience_teaching_ruby_testing.md
Last active Nov 3, 2019
@tenderlove asked about the wisdom of teaching RSpec to new Ruby developers. I have some relevant experience. Here it is, for what it's worth.
View experience_teaching_ruby_testing.md

Notes on teaching both test/unit and RSpec to new Ruby developers

@tenderlove asked "Is it good to teach RSpec (vs t/u) to people who are totally new to Ruby?" I have experience suggesting that it is a good thing; after a short back and forth, it seemed useful to write it up in detail.

Background

This goes back several years, to when I was the primary Ruby/Rails trainer for Relevance from 2006-2009. I'm guessing that worked out to probably 6-8 classes a year during those years. Since then, RSpec has changed a fair amount (with the addition of expect) and test/unit has changed radically (it has an entirely new implementation, minitest, that avoids some of the inconsistencies that made test/unit a bit confusing during the time I'm writing about here).

I started out as an RSpec skeptic. I've never been afraid of what a lot of people denigrate as "magic" in Ruby libraries … to me, if you take the trouble to understand it, that stuff's just pr

@bitemyapp
bitemyapp / gist:8739525
Last active May 7, 2021
Learning Haskell
View gist:8739525
@freshtonic
freshtonic / pre-commit
Last active Dec 2, 2020
Git commit hook to abort commits when I accidentally commit dumb shit.
View pre-commit
#!/usr/bin/env ruby
# Checks for things that I often commit accidentally and bails out of the
# commit. To skip this pre-commit hook use `git commit --no-verify`.
checks = [
/\bddescribe\b/,
/\biit\b/,
/\bxit\b/,
/binding.pry/,