Skip to content

Instantly share code, notes, and snippets.

@ccarrasc
ccarrasc / stomp-client.ts
Created March 31, 2017 12:32
Stomp client wrapped in Angular Service
import { Injectable } from '@angular/core';
import { Observable, Observer, BehaviorSubject, ReplaySubject } from 'rxjs/Rx';
import * as SockJS from 'sockjs-client';
import { Client, Frame, Stomp } from 'stompjs';
const DEFAULT_CACHE_SIZE: number = 100;
class TopicSubscription {
public subscription: any = null;
public subject: ReplaySubject<any>;
@ccarrasc
ccarrasc / first-build.md
Last active August 14, 2024 17:31
archlinux installation and configuration notes
@ccarrasc
ccarrasc / toCamelCaseProps.ts
Created July 24, 2018 18:35
Convert PascalCased props to camelCase (not really tested)
const toCamelCaseProps = (obj: any) => {
return Object.keys(obj).reduce((renamed, key) => {
let value = obj[key];
if (typeof value === 'object' && value) {
value = toCamelCaseProps(value);
}
const camelCasedKey = key.charAt(0).toLowerCase() + key.slice(1);
renamed[camelCasedKey] = value;
return renamed;
@ccarrasc
ccarrasc / IOS_LIB_CARTHAGE.md
Created August 13, 2018 13:13
Scaffold and iOS lib project using Carthage
  1. Create a Cartfile with needed dependencies
  2. Create a Cartfile.private with internal/test dependencies carthage update
  3. Launch Xcode and create a new workspace: FileNewWorkspace
  4. Create a Library project: FileNewProjectCocoa Touch Framework Be sure to add it to the recently created Workspace and group to the Workspace
  5. Create an App project: FileNewProjectSingle View App
    1. Add it to the recently created Workspace and group to the Workspace
  6. Enable your library project to provide a shared schema: (Target selector) → Manage Schemas…
@ccarrasc
ccarrasc / example.groovy
Created March 11, 2020 19:29
Execute shell command through Jenkins script (Groovy)
def out = new StringBuilder()
def err = new StringBuilder()
def proc = 'ls -lrt'.execute()
proc.consumeProcessOutput(out, err)
proc.waitForProcessOutput()
println "$out"
println "$err"