Skip to content

Instantly share code, notes, and snippets.

@veeramarni
veeramarni / index.html
Created January 18, 2021 16:46 — forked from mjbvz/index.html
Electron Fiddle Gist
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<link rel="stylesheet" type="text/css" href="./styles.css">
</head>
<body>
<script>
require('./renderer.js')
@veeramarni
veeramarni / Jenkinsfile
Created January 4, 2020 23:58 — forked from merikan/Jenkinsfile
Some Jenkinsfile examples
View Jenkinsfile
Some Jenkinsfile examples
View mock-file.ts
import { URI } from '@vscode/monaco-editor/esm/vs/base/common/uri';
import { ITextModelContentProvider } from '@vscode/monaco-editor/esm/vs/editor/common/services/resolverService';
import { ApolloClient } from 'apollo-client';
import { IModelService, IModeService } from '@workbench-stack/core';
import { ILanguageSelection } from '@vscode/monaco-editor/esm/vs/editor/common/services/modeService';
// import { IFileDataSubscription } from '@files-stack/client-state';
import gql from 'graphql-tag';
export const FileContent_WsDocument = gql`
query aQuery {
View gist:76ed05fe0f550b98db8dd0a8e20ac3c6
test('test rxjs marble', async () => {
const testScheduler = new TestScheduler((actual, expected) => {
expect(actual).toEqual(expected);
});
const fetchUserEpic = (action$, state$, { getJSON }) => action$.pipe(
ofType('FETCH_USER'),
mergeMap(action =>
getJSON(`https://api.github.com/users/${action.id}`).pipe(
map(response => ({ type: 'FETCH_USER_FULFILLED', response }))
@veeramarni
veeramarni / server-test.ts
Last active April 17, 2019 20:06
Apollo-Server-with-Client
View server-test.ts
import gql from 'graphql-tag';
import 'jest';
import { createTestClient } from 'apollo-server-testing';
import { InMemoryCache } from 'apollo-cache-inmemory';
import { ApolloServer } from 'apollo-server';
/**
* Server side graphql test uses createTestClient from
* https://github.com/apollographql/apollo-server/blob/master/packages/apollo-server-testing/src/createTestClient.ts
@veeramarni
veeramarni / client-test.ts
Last active April 9, 2019 22:33
Apollo Client Test Sample
View client-test.ts
import { ApolloClient } from 'apollo-client';
import { InMemoryCache } from 'apollo-cache-inmemory';
import { withClientState } from 'apollo-link-state';
import { ApolloLink } from 'apollo-link';
import gql from 'graphql-tag';
import 'jest';
describe('Apollo Client tests', () => {
View gist:d097084e2fc67a3bdf01b66fe94cdf3a
vscode uses its own DI.
https://github.com/Microsoft/vscode/issues/4274
https://github.com/joelday/decoration-ioc
View folder-structure.md

Folder Structure

Motivations

  • Clear feature ownership
  • Module usage predictibility (refactoring, maintainence, you know what's shared, what's not, prevents accidental regressions, avoids huge directories of not-actually-reusable modules, etc)
@veeramarni
veeramarni / meteor-async.md
Created January 4, 2016 16:42 — forked from possibilities/meteor-async.md
Meteor Async Guide
View meteor-async.md

From Meteor's documentation:

In Meteor, your server code runs in a single thread per request, not in the asynchronous callback style typical of Node. We find the linear execution model a better fit for the typical server code in a Meteor application.

This guide serves as a mini-tour of tools, trix and patterns that can be used to run async code in Meteor.

Basic async

Sometimes we need to run async code in Meteor.methods. For this we create a Future to block until the async code has finished. This pattern can be seen all over Meteor's own codebase:

@veeramarni
veeramarni / devert
Created December 22, 2015 10:39 — forked from cfr/devert
Fix vertical video
View devert
#!/usr/bin/env sh
# http://stackoverflow.com/a/30819570/187663
ffmpeg -i $1 -i $1 -filter_complex "[0:v]scale=-1:720[scaled_video];[1:v]scale=1280:720,boxblur=16[blur_image];[blur_image][scaled_video]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2[outv]" -c:v libx264 -aspect 1280/720 -map [outv] -map 0:a -c:a copy $1.fixed.mp4