Skip to content

Instantly share code, notes, and snippets.

Avatar

Jose Ignacio Santa Cruz G. jsanta

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am jsanta on github.
  • I am jsanta (https://keybase.io/jsanta) on keybase.
  • I have a public key whose fingerprint is 8F01 7220 E8B9 4411 34E2 6E9C BF73 7302 E167 8987

To claim this, I am signing this object:

@jsanta
jsanta / ocLazyLoad-uiRouterDecorator.js
Created May 25, 2017
OC LazyLoad decorator for UI router
View ocLazyLoad-uiRouterDecorator.js
// From: http://plnkr.co/edit/6CLDsz?p=info
define([
'angular',
'uiRouter',
'ocLazyLoad'
], function (angular) {
angular.module('oc.lazyLoad.uiRouterDecorator', ['ui.router']).config(function($stateProvider) {
@jsanta
jsanta / countries.js
Created Aug 18, 2017
Missing countries for mrz package
View countries.js
// Generated countries for https://github.com/cheminfo-js/mrz
// taken from https://github.com/newtondev/mrz-parser
var _countries = [];
_countries["AFG"] = "Afghanistan";
_countries["ALB"] = "Albania";
_countries["DZA"] = "Algeria";
_countries["ASM"] = "American Samoa";
_countries["AND"] = "Andorra";
_countries["AGO"] = "Angola";
@jsanta
jsanta / jsanta.zsh-theme
Created Jan 19, 2018
A customized oh-my-zsh theme. Works for me.
View jsanta.zsh-theme
local ret_status="%(?:%{$fg_bold[green]%}:%{$fg_bold[red]%})"
PROMPT='%n@%m [%*]:%d
${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
@jsanta
jsanta / launch.json
Created Feb 14, 2018
launch,json for debugging using VS Code
View launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chromium against localhost",
"url": "http://localhost:4200/#",
"webRoot": "${workspaceFolder}",
"runtimeExecutable": "/usr/bin/chromium-browser",
@jsanta
jsanta / company-generator-template.txt
Last active Mar 9, 2018
Sample data generator template
View company-generator-template.txt
[
'{{repeat(15, 30)}}',
{
index: '{{index(1)}}',
guid: '{{guid()}}',
color: '{{random("blue", "green", "red", "yellow")}}',
company: '{{company().toUpperCase()}}',
country: '{{country()}}'
}
]
@jsanta
jsanta / toggleFilter.ts
Created Mar 9, 2018
toggleFilter function. Adds or removes a simple search filter from the activeFilters array. Then it filters the original data to a filteredData array.
View toggleFilter.ts
private activeFilters: Array<string> = [];
toggleFilter(_filter: string) {
const filterIdx: number = findIndex(this.activeFilters, (v) => v === _filter );
if (filterIdx !== -1) {
pullAt(this.activeFilters, [ filterIdx ]);
} else {
this.activeFilters.push(_filter);
}
this.filteredData = filter(this.data, (v) => includes(this.activeFilters, v.color));
@jsanta
jsanta / resetFilters.ts
Created Mar 9, 2018
resetFilter function, to reset all active filter to their default state (no active filters)
View resetFilters.ts
resetFilters() {
this.activeFilters = [];
this.filteredData = this.data;
}
@jsanta
jsanta / data-grid.component.ts
Created Mar 9, 2018
DataGridComponent for displaying a filtered data grid.
View data-grid.component.ts
import { Company } from './../../data/company-data';
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-data-grid',
templateUrl: './data-grid.component.html',
styleUrls: ['./data-grid.component.sass']
})
export class DataGridComponent implements OnInit {
@jsanta
jsanta / grid-page.component.html
Created Mar 9, 2018
Grid page with the button filters.
View grid-page.component.html
<p>
Press a button to visually filter results
</p>
<form>
<div class="row">
<div class="float-left pr-1"><button type="button" class="btn btn-md"
(click)="resetFilters()">All</button></div>
<div class="float-left pr-1"><button type="button" class="btn btn-md btn-info"
(click)="toggleFilter('blue')">Blue</button></div>
<div class="float-left pr-1"><button type="button" class="btn btn-md btn-success"