title | slug | createdAt | language | preview |
---|---|---|---|---|
React Hook prompting the user to "Add to homescreen" |
react-hook-prompting-the-user-to-add |
2018-11-29T20:35:02Z |
en |
Simple React Hook for showing the user a custom "Add to homescreen" prompt. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* * * * * * * * * * * * * * * * * * * * * * * * * | |
SASS string functions: | |
camelCase, kebabCase, titleCase, toLower, etc. | |
------------------------------------------------- | |
2021 Nicholas Berlette - https://git.io/Js3HD | |
* * * * * * * * * * * * * * * * * * * * * * * * */ | |
@use "sass:string"; | |
/* | |
upperCase($string) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useLayoutEffect } from 'react' | |
const useWindowSize = () => { | |
const [size, setSize] = useState([0, 0]) | |
useLayoutEffect(() => { | |
const updateSize = () => { | |
setSize([window.innerWidth, window.innerHeight]) | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
/* | |
tmuxfixer.js | |
USAGE: | |
$ node tmuxfixer.js old-conf-path [new-conf-path] | |
PURPOSE & CONTEXT: This script takes in a tmux configuration file and combines | |
all deprecated -fg, -bg, and -attr into a single -style option line. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Try at : https://graphql-explorer.githubapp.com/ | |
// With query variables below | |
// { "queryString": "language:JavaScript stars:>10000" } | |
query SearchMostTop10Star($queryString: String!) { | |
search(query: $queryString, type: REPOSITORY, first: 10) { | |
repositoryCount | |
edges { | |
node { | |
... on Repository { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script charset="utf-8"> | |
<% if ENV["RAILS_ENV"] == "production" %> | |
var script = "/react-app-bundle.js"; | |
<% else %> | |
console.warn("Development mode. Make sure to start 'node devServer.js'"); | |
var script = "http://" + (location.host || 'localhost').split(':')[0] + ":4000/react-app-bundle.js" | |
<% end %> | |
document.write('<script src="' + script + '"></' + 'script>'); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// tests/acceptance/foo-test.js | |
// Assert that text should be found | |
assert.hasText('Not Found'); // Error: Could not find text "Not Found" on the page | |
// Provide custom message | |
assert.hasText('Not Found', 'Expected to find "Not Found"'); // Error: Expected to find "Not Found" | |
// Find any number of elements containing the query text | |
text('Found'); // [<div>Found</div>, <input value="Found">] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Source: https://gist.github.com/fritz-c/c1e528b09bc1c0827a3c | |
# Original: https://gist.github.com/jordan-brough/48e2803c0ffa6dc2e0bd | |
# Download this script as "git-recentco" (no extension), chmod it to be executable and put it in your | |
# path somewhere (e.g. /usr/bin). You can then use it via `git recentco` from inside any git repo. | |
# Example: | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ok, so Inheritance | |
its not just for young white dudes waiting for their grandparents to fucking keel over at 82. | |
In ruby, Inheritance allows one class to inherit from another class attributes and behaviors (methods) that it didnt have before. The inheriter, much like a young white male, is the child class. The class that it inherits from, rather than being his old money grandparents, is the Parent Class. The lesson says Inheritance is designated with a < symbol, for example: | |
class Daughter < Father | |
end | |
wow, quick right. So for that, the daughter is getting methods from the father. Simple right. But lets go deeper and se how fucked up this can really get for those of us in the cheap seats. |