Skip to content

Instantly share code, notes, and snippets.

@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"
@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 / 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 / first-build.md
Last active August 14, 2024 17:31
archlinux installation and configuration notes
@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 / local-storage.service.ts
Last active April 4, 2023 16:57
Wrapping storage access with BehaviorSubject for Angular
import { Injectable } from '@angular/core';
import StorageService from './storage.service';
@Injectable()
export class LocalStorageService extends StorageService {
private _storage = localStorage;
constructor() {
super();
@ccarrasc
ccarrasc / gulpfile.js
Last active December 15, 2016 11:01
simple sass gulp task
'use strict';
let gulp = require('gulp');
let sass = require('gulp-sass');
let buildStyles = (src, dest) => {
let themes = `${__dirname}/sass/themes`; // convention is _some-theme.scss => @import 'some-theme';
let components = `${__dirname}/sass/components`;
return new Promise((resolve, reject) => {
gulp.src(src)
@ccarrasc
ccarrasc / .tmux.conf
Last active August 2, 2017 14:41
Simple tmux config (macOS)
setw -g mode-keys vi
set -g mouse on
set -g base-index 1
set -g default-terminal "screen-256color"
# Panes
setw -g pane-base-index 1
set -g pane-border-fg colour236
set -g pane-active-border-fg colour030
@ccarrasc
ccarrasc / show-hidden.sh
Created April 22, 2015 21:17
Show hidden files in Finder on OSX
#!/bin/bash
defaults write com.apple.finder AppleShowAllFiles YES
# Changes will appear when you next launch Finder
exit
@ccarrasc
ccarrasc / in-app-ad.html
Created February 13, 2015 15:10
DoubleClick snippet for opening a URL with an in-app browser rather than Mobile Safari
<!-- ref: http://media.admob.com/api/v1/docs/ -->
<script type="text/javascript" src="http://media.admob.com/api/v1/google_mobile_app_ads.js"></script>
<a href="[%DEST_URL_ESC_ESC%]" onclick="admob.opener.openUrl('[%DEST_URL_ESC_ESC%]', false); return false;">
<img border="0" src="[%IMAGESRC%]" width="[%WIDTH%]" height="[%HEIGHT%]">
</a>