Skip to content

Instantly share code, notes, and snippets.

View ArjanJ's full-sized avatar
🍫

Arjan Jassal ArjanJ

🍫
View GitHub Profile
@timosadchiy
timosadchiy / jest.config.js
Last active September 22, 2023 05:46
Jest + Typescript. Resolve tsconfig.json paths.
/**
* Converts paths defined in tsconfig.json to the format of
* moduleNameMapper in jest.config.js.
*
* For example, {'@alias/*': [ 'path/to/alias/*' ]}
* Becomes {'@alias/(.*)': [ '<rootDir>/path/to/alias/$1' ]}
*
* @param {string} srcPath
* @param {string} tsconfigPath
*/
@hubgit
hubgit / SelectField.tsx
Last active December 29, 2023 03:41
Use react-select with Formik
import { FieldProps } from 'formik'
import React from 'react'
import Select, { Option, ReactSelectProps } from 'react-select'
export const SelectField: React.SFC<ReactSelectProps & FieldProps> = ({
options,
field,
form,
}) => (
<Select
@victorouse
victorouse / dom.html
Created March 4, 2018 04:57
Facebook Interview: Given two identical DOM tree structures, A and B, and a node from A, find the corresponding node in B
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Facebook DOM Traversal</title>
</head>
<body>
<div id="rootA">
<div>
@recca0120
recca0120 / Facebook.js
Created June 22, 2017 05:10
Facebook Promise Wrapper
'use strict';
export class Facebook {
getScript() {
return new Promise((resolve) => {
if (window.FB) {
resolve(window.FB);
}
const id = 'facebook-jssdk';
@rachsmithcodes
rachsmithcodes / javascript.json
Last active June 15, 2017 23:28
New Container Component VSCode User Snippet
"New Container Component": {
"prefix": "ncc",
"body": [
"import { connect } from 'react-redux';",
"import ${1:name} from './${1:name}';",
"",
"const mapStateToProps = state => {",
" return {$2};",
"};",
"",
@wesbos
wesbos / tab-trigger.js
Created November 16, 2015 19:33
How to properly get a TAB trigger working with Emmet inside of JSX
{
"keys": ["tab"],
"command": "expand_abbreviation_by_tab",
// put comma-separated syntax selectors for which
// you want to expandEmmet abbreviations into "operand" key
// instead of SCOPE_SELECTOR.
// Examples: source.js, text.html - source
"context": [
{
@miguelmota
miguelmota / .bash_aliases
Last active October 2, 2018 12:14
Python SimpleHTTPServer alias for .bashrc
# Fires up a web server on localhost:8000
#
# Example:
#
# ~/workspace $ server
# Serving HTTP on 0.0.0.0 port 8000 ...
function server() {
local port="${1:-8000}"
open "http://localhost:${port}/"
@O-Zone
O-Zone / transitionEnd.js
Last active November 23, 2023 22:43
Get the name of the browsers transitionEnd event. After calling this, window.transitionEnd will contain the browser specific name of the transitionEnd event. This is an extract of EvandroLG's transitionEnd snippet, without all support for testing different elements and using cache.
(function (window) {
var transitions = {
'transition': 'transitionend',
'WebkitTransition': 'webkitTransitionEnd',
'MozTransition': 'transitionend',
'OTransition': 'otransitionend'
},
elem = document.createElement('div');
for(var t in transitions){
@ravasthi
ravasthi / _config.yml
Created February 15, 2012 08:59
Multiple authors on Jekyll
authors:
hanzou:
name: Hanzou Hattori
display_name: Hanzou
gravatar: c66919cb194f96c696c1da0c47354a6a
email: hanzou@company.com
web: http://company.com
twitter: company
github: hhattori
jorgen: