Skip to content

Instantly share code, notes, and snippets.

View ashwanth1109's full-sized avatar
💭
Do or do not, there is no try . . .

Ashwanth A R ashwanth1109

💭
Do or do not, there is no try . . .
View GitHub Profile
@alexpchin
alexpchin / restful_routes.md
Last active July 2, 2024 19:01
7 Restful Routes
URL HTTP Verb Action
/photos/ GET index
/photos/new GET new
/photos POST create
/photos/:id GET show
/photos/:id/edit GET edit
/photos/:id PATCH/PUT update
/photos/:id DELETE destroy
@kayhadrin
kayhadrin / triggerMouseEvent.js
Last active February 6, 2023 16:49
Trigger mouse event programmatically. Useful to simulate mouse wheel events.
/**
* Simulate a mouse event to a given DOM element
* @param {string, WebElement} elem
* @param {string} evtName Event name
* @param {object} eventInitProps Properties to set on the mouse event
*/
function triggerMouseEvent(elem, evtName, eventInitProps) {
return browser.executeScript(function(_elem, _evtName, _eventInitProps) {
var $ = window.jQuery;
elem = $(_elem);
@drodsou
drodsou / writeFileSyncRecursive.js
Last active June 5, 2024 15:57
Like writeFileSync but creating all folder paths if not exist
// -- updated in 2020/04/19 covering the issues in the comments to this point
// -- remember you also have things like `ensureDirSync` from https://github.com/jprichardson/node-fs-extra/blob/master/docs/ensureDir-sync.md
const fs = require('fs')
function writeFileSyncRecursive(filename, content, charset) {
// -- normalize path separator to '/' instead of path.sep,
// -- as / works in node for Windows as well, and mixed \\ and / can appear in the path
let filepath = filename.replace(/\\/g,'/');
// -- preparation to allow absolute paths as well
@pikanji
pikanji / graphql-directives.js
Last active June 13, 2024 01:19
Amplify GraphQL Directive Definitions
import gql from 'graphql-tag';
// https://docs.amplify.aws/cli-legacy/graphql-transformer/directives/
const clientSchemaExtensions = gql`
# https://docs.amplify.aws/cli/graphql/data-modeling/#how-it-works
directive @model(
queries: ModelQueryMap
mutations: ModelMutationMap
subscriptions: ModelSubscriptionMap
timestamps: TimestampConfiguration