This file contains hidden or 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
/* eslint-disable ember/no-computed-properties-in-native-classes */ | |
import { render, settled } from '@ember/test-helpers'; | |
import { setupRenderingTest } from 'ember-qunit'; | |
import hbs from 'htmlbars-inline-precompile'; | |
import { module, test } from 'qunit'; | |
import { set, defineProperty, computed } from '@ember/object'; | |
function example(target) { | |
defineProperty( | |
target.prototype, |
This file contains hidden or 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, { useEffect, useState } from "react"; | |
export default function App() { | |
const [count, setCount] = useState(1); | |
const [autoCount, setAutoCount] = useState(1); | |
useAsyncEffect( | |
function* () { | |
while (true) { | |
yield new Promise((resolve) => setTimeout(resolve, 1000)); |
This file contains hidden or 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
/** | |
* Strip EXIF data from JPEGs | |
* | |
* @param {File} file | |
*/ | |
const stripExifFromJPEGs = (file: File): Promise<File | Blob> => { | |
// We want to strip the EXIF data only from JPEGs | |
if (file.type !== 'image/jpeg') { | |
return Promise.resolve(file) | |
} |
This file contains hidden or 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
# Use the following command to install Ruby 2.6.6 | |
# The other 2.6 version might need this as well | |
set -gx optflags "-Wno-error=implicit-function-declaration" | |
set -gx LDFLAGS "-L/opt/homebrew/opt/libffi/lib" | |
set -gx CPPFLAGS "-I/opt/homebrew/opt/libffi/include" | |
set -gx PKG_CONFIG_PATH "/opt/homebrew/opt/libffi/lib/pkgconfig" | |
asdf install ruby 2.6.6 |
This file contains hidden or 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
for db in (mysql -u root -e "SHOW DATABASES WHERE `Database` NOT LIKE '%test%'" -s --skip-column-names); | |
mysqldump -u root --single-transaction (string trim $db) > (string trim $db).dump; | |
end |
This file contains hidden or 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
gem install mysql2 -v '0.5.3' -- --with-cflags=\"-I/usr/local/opt/openssl/include\" --with-ldflags=\"-L/usr/local/opt/openssl/lib\" |
This file contains hidden or 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, { createContext, useContext, useRef } from 'react'; | |
import { Socket } from 'phoenix'; | |
import AuthContext from './AuthContext'; | |
const SocketContext = createContext<Socket>({} as Socket); | |
const SocketConsumer = SocketContext.Consumer; | |
const SocketProvider: React.FC = ({ children }) => { | |
let token = useContext(AuthContext).token!; | |
let socketRef = useRef<{ |
This file contains hidden or 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
Show hidden characters
{ | |
"compilerOptions": { | |
"target": "es2018", | |
"experimentalDecorators": true, | |
"baseUrl": ".", | |
"paths": { | |
"{put-your-app-name-here}/tests/*": ["./tests/*"], | |
"{put-your-app-name-here}/mirage/*": ["./mirage/*"], | |
"{put-your-app-name-here}/*": ["./app/*"] | |
} |
This file contains hidden or 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 Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
This file contains hidden or 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 Helper from '@ember/component/helper'; | |
import { inject as service } from '@ember/service'; | |
export default Helper.extend({ | |
router: service(), | |
compute(params) { | |
return (maybeEvent) => { | |
if (maybeEvent !== undefined && typeof maybeEvent.preventDefault === 'function') { | |
maybeEvent.preventDefault(); |
NewerOlder