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:
@malarkey
malarkey / Contract Killer 3.md
Last active May 24, 2024 23:38
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@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')