Skip to content

Instantly share code, notes, and snippets.

@jimmynguyc
jimmynguyc / manual_publication_write.rb
Created May 23, 2020 03:49
Overcoming lack of publication_write permission for Shopify private apps
require "byebug"
require "time"
require "capybara/cuprite"
require "capybara/dsl"
require "capybara/rspec/matchers"
require "rspec/expectations"
include Capybara::DSL
include Capybara::RSpecMatchers
@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)
@ModPhoenix
ModPhoenix / axios-interceptors-refresh-token.js
Last active January 30, 2024 07:14
Axios interceptors token refresh for few async requests. ES6
import axios from "axios";
import { settings } from "../settings";
import { authAPI } from ".";
const request = axios.create({
baseURL: settings.apiV1,
});
request.interceptors.request.use(
(config) => {
@letehaha
letehaha / pre-commit-hook.sh
Last active October 21, 2020 09:22
Checks eslint errors/warnings in pre-commit hook. Disable commit if errors found
# !/bin/sh
files=$(git diff --cached --name-only --diff-filter=ACM | grep -E "(.js|.vue)$")
if [ "$files" == "" ]; then
exit 0
fi
lintfiles=""
errors="false"
@lukaszgrolik
lukaszgrolik / font-weights.md
Last active April 24, 2024 11:29
Commonly used names for CSS font-weight values

unknown source

value name
100 extralight/ultralight
200 light/thin
300 book/demi/light
400 regular/normal
500 medium
600 semibold/demibold
@adamjohnson
adamjohnson / publickey-git-error.markdown
Last active April 18, 2024 01:00
Fix "Permission denied (publickey)" error when pushing with Git

"Help, I keep getting a 'Permission Denied (publickey)' error when I push!"

This means, on your local machine, you haven't made any SSH keys. Not to worry. Here's how to fix:

  1. Open git bash (Use the Windows search. To find it, type "git bash") or the Mac Terminal. Pro Tip: You can use any *nix based command prompt (but not the default Windows Command Prompt!)
  2. Type cd ~/.ssh. This will take you to the root directory for Git (Likely C:\Users\[YOUR-USER-NAME]\.ssh\ on Windows)
  3. Within the .ssh folder, there should be these two files: id_rsa and id_rsa.pub. These are the files that tell your computer how to communicate with GitHub, BitBucket, or any other Git based service. Type ls to see a directory listing. If those two files don't show up, proceed to the next step. NOTE: Your SSH keys must be named id_rsa and id_rsa.pub in order for Git, GitHub, and BitBucket to recognize them by default.
  4. To create the SSH keys, type ssh-keygen -t rsa -C "your_email@example.com". Th
@joemaygist
joemaygist / applescript_spotify_next_track.applescript
Created April 29, 2013 15:18
AppleScript: Spotify Next track
tell application "Spotify"
next track
end tell
@mbinna
mbinna / podforceupdate.sh
Created December 4, 2012 09:43
Clear CocoaPods cache, re-download and re-install all pods
#!/usr/bin/env bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update
@duncansmart
duncansmart / MailgunTest.cs
Created September 24, 2012 18:38
Send a mail message via Mailgun using HttpClient
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
[TestFixture]
public class MyClass
{
const string DOMAIN = "samples.mailgun.org";
const string API_KEY = "key-...";