Skip to content

Instantly share code, notes, and snippets.

@cassidoo
cassidoo / useMedia.jsx
Last active October 27, 2022 16:13
An example of checking on a media query with React Hooks
function useMedia(query) {
const [matches, setMatches] = useState(window.matchMedia(query).matches)
useEffect(() => {
const media = window.matchMedia(query)
if (media.matches !== matches) {
setMatches(media.matches)
}
const listener = () => {
setMatches(media.matches)
@manekinekko
manekinekko / set_proxy.sh
Last active May 4, 2019 12:35
Toggling Proxy Settings for Git, NPM, Bower and Package Control (Mac OS X) automatically
#! /bin/sh
proxy="YOUR_PROXY"
if [ "$1" == "on" ]; then
echo "exporting proxy"
export http_proxy=$proxy
export https_proxy=$proxy
@MrJaba
MrJaba / programming-resources.txt
Created June 19, 2014 07:33
List of interesting programming resources
Podcasts:
Ruby Rogues - http://rubyrogues.com/
Ruby5 - http://ruby5.envylabs.com/
FunctionalGeekery - http://www.functionalgeekery.com/
Screencasts:
Destroy all software - https://www.destroyallsoftware.com/screencasts
Ruby Tapas - http://www.rubytapas.com/
News:
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')