Skip to content

Instantly share code, notes, and snippets.

View AndreiMotinga's full-sized avatar

Andrei Motinga AndreiMotinga

View GitHub Profile
@Lukeghenco
Lukeghenco / Enzyme-React-Testing-Libary-step-13.jsx
Last active October 23, 2019 07:27
Enzyme/React-Testing-Libary Step: 13
import React from 'react'
import { cleanup, render } from 'react-testing-library'
import TextAreaInput from './TextAreaInput'
const defaultProps = {
labelText: 'I am a label',
name: 'comment',
className: 'textarea-box',
labelClassName: 'small-heading',
handleOnChange: () => {}
@gauntface
gauntface / sw-test-cleaup.js
Last active April 22, 2024 05:02
Function to unregister SW and clear out old caches.
window.__testCleanup = () => {
const unregisterSW = () => {
return navigator.serviceWorker.getRegistrations()
.then((registrations) => {
const unregisterPromise = registrations.map((registration) => {
return registration.unregister();
});
return Promise.all(unregisterPromise);
});
};
@jkubacki
jkubacki / gist:e2dd904bd648b0bd4554
Created January 21, 2015 18:47
Mac uninstall elasticsearch
#!/usr/bin/env sh
# checks to see if running
launchctl list | grep elasticsearch
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
launchctl remove homebrew.mxcl.elasticsearch
pkill -f elasticsearch
@ryansobol
ryansobol / gist:5252653
Last active November 22, 2023 11:53
15 Questions to Ask During a Ruby Interview

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

@bunnymatic
bunnymatic / nested_content_snippet.rb
Created December 6, 2012 08:28
nested content in rails view helpers
# because i can never remember exactly how and when to use concat
# when building content in helpers
def nested_content
content_tag 'div' do
concat(content_tag 'span', 'span block')
concat(tag 'br')
concat(link_to 'root link', root_path)
concat(tag 'br')
concat(link_to('#') do
concat(content_tag 'h2', 'Head \'em off')