Skip to content

Instantly share code, notes, and snippets.

Donald Pipowitch donaldpipowitch

Block or report user

Report or block donaldpipowitch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@donaldpipowitch
donaldpipowitch / auto-update-service.js
Created Jun 3, 2014
Add auto-update functionality to Restangular (only for collection.post, model.get and model.remove in this example)
View auto-update-service.js
angular.module('extensions.restangular.auto-update', [
'restangular'
]);
angular.module('extensions.restangular.auto-update')
.factory('RestangularAutoUpdate', function RestangularAutoUpdate(Restangular) {
// properties
var _routes = [];
@donaldpipowitch
donaldpipowitch / unit.jsx
Created Apr 27, 2016
React Unit Test: Shallow Rendering
View unit.jsx
import React from 'react';
import expect from 'expect';
import ReactTestUtils from 'react-addons-test-utils';
export const NameComponent = ({ name }) => <span>Hello {name}!</span>;
describe('name component', () => {
it('should render the name', () => {
const renderer = ReactTestUtils.createRenderer();
renderer.render(<NameComponent name="foo" />);
@donaldpipowitch
donaldpipowitch / unit.jsx
Created Apr 27, 2016
React Unit Test: Shallow Rendering with Enzyme
View unit.jsx
import React from 'react';
import expect from 'expect';
import { shallow } from 'enzyme';
export const NameComponent = ({ name }) => <span>Hello {name}!</span>;
describe('name component', () => {
it('should render the name', () => {
const wrapper = shallow(<NameComponent name="foo" />);
expect(wrapper.type()).toBe('span');
@donaldpipowitch
donaldpipowitch / README.md
Last active Jul 10, 2017
selenium-webdriver and selenium-standalone example
View README.md

This example shows you how to use selenium-webdriver and selenium-standalone in modern versions with Firefox, Chrome and Safari and without the promise manager.

@donaldpipowitch
donaldpipowitch / README.md
Last active Aug 28, 2017
JSON-LD examples
View README.md

Not sure, if these are all valid.

I basically want to add links to my data. In HAL it probably would lool like this:

{
    "_links": {
        "self": {
            "href": "https://example.com/users/1"
        },
@donaldpipowitch
donaldpipowitch / README.md
Created Sep 14, 2017
Relations in JSON-LD
View README.md

I don't know, if it is correct to use IANA relations in this way and to add custom relations.

But these examples are parsed in the same way.

inlined relations

{
  "http://www.iana.org/assignments/relation/self": {
    "@id": "https://api.example.com/users/1"
View strace ping
11433 execve("/bin/ping", ["ping", "google.com"], [/* 14 vars */]) = 0
11433 brk(NULL) = 0xc9b000
11433 fcntl(0, F_GETFD) = 0
11433 fcntl(1, F_GETFD) = 0
11433 fcntl(2, F_GETFD) = 0
11433 access("/etc/suid-debug", F_OK) = -1 ENOENT (No such file or directory)
11433 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
11433 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
11433 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
11433 fstat(3, {st_mode=S_IFREG|0644, st_size=33275, ...}) = 0
View xsel.strace
18154 execve("/usr/bin/xsel", ["xsel"], [/* 18 vars */]) = 0
18154 brk(NULL) = 0x1cbc000
18154 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
18154 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
18154 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
18154 fstat(3, {st_mode=S_IFREG|0644, st_size=48267, ...}) = 0
18154 mmap(NULL, 48267, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fda9d0d2000
18154 close(3) = 0
18154 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
18154 open("/usr/lib/x86_64-linux-gnu/libX11.so.6", O_RDONLY|O_CLOEXEC) = 3
@donaldpipowitch
donaldpipowitch / index.js
Created May 14, 2018
async generator function: count until 5
View index.js
// works in current chrome (logs from 1 to 5 every second)
function sleep(milliseconds) {
return new Promise(resolve => setTimeout(resolve, milliseconds))
}
async function* seconds() {
let second = 0;
while (true) {
await sleep(1000);
@donaldpipowitch
donaldpipowitch / Lazy.tsx
Last active Jun 26, 2018
Lazy loading a React component with TypeScript 2.2
View Lazy.tsx
// this is our imaginary package "react-lazy"
import React, { Component, createElement } from 'react';
import { Redirect } from 'react-router-dom';
import { observer } from 'mobx-react';
import { observable } from 'mobx';
/**
* This is generic module interface. We assume that we can access React components.
*/
export interface FetchedModule {
You can’t perform that action at this time.