Skip to content

Instantly share code, notes, and snippets.

View larissaamancio's full-sized avatar
😍

Larissa Amancio larissaamancio

😍
View GitHub Profile
#!/usr/bin/env node
// Channel ID is on the the browser URL.: https://mycompany.slack.com/messages/MYCHANNELID/
// Token can get from: https://api.slack.com/custom-integrations/legacy-tokens
// Pass it as a parameter: node ./delete-slack-messages.js TOKEN CHANNEL_ID
// Or use it without download the script: curl -Ls RAW_GIST_URL | node - TOKEN CHANNEL_ID
// GLOBALS #############################################################################################################
const [, , token, channel, _delay = 300] = process.argv
let delay = _delay // Allow inscrease delay later - thanks `colinricardo` for pointing it out
if (!token || !channel) {
console.log('Usage: node ./delete-slack-messages.js TOKEN CHANNEL_ID')
def miniMaxSum(arr):
arr_sorted = sorted(arr)
return sum(arr_sorted[:4]), sum(arr_sorted[-4:])
print(miniMaxSum([1,2,3,4,5]))
print(miniMaxSum([5,5,5,5,5]))
@larissaamancio
larissaamancio / install-docker.sh
Created January 14, 2020 15:23 — forked from sethbergman/install-docker.sh
Install Docker CE on Linux Mint 19
#!/usr/bin/env bash
# https://docs.docker.com/install/linux/docker-ce/ubuntu/
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
@larissaamancio
larissaamancio / kubectl-shortcuts.sh
Created August 22, 2019 16:53 — forked from tamas-molnar/kubectl-shortcuts.sh
aliases and shortcuts for kubectl
alias kc='kubectl'
alias kclf='kubectl logs --tail=200 -f'
alias kcgs='kubectl get service -o wide'
alias kcgd='kubectl get deployment -o wide'
alias kcgp='kubectl get pod -o wide'
alias kcgn='kubectl get node -o wide'
alias kcdp='kubectl describe pod'
alias kcds='kubectl describe service'
alias kcdd='kubectl describe deployment'
alias kcdf='kubectl delete -f'
import {ChangeDetectionStrategy, Component, Input} from "@angular/core";
import {Observable} from 'rxjs/Observable';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/delay';
interface IServerResponse {
items: string[];
total: number;
import { Injectable } from '@angular/core';
import { Router, CanActivate } from '@angular/router';
import { JwtHelperService } from '@auth0/angular-jwt';
@Injectable()
export class AuthGuardService implements CanActivate {
constructor(private router: Router) { }
canActivate() {
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
login(username: string, password: string): Observable<any> {
return this.http.post<any>('https://coral.hmg.cloud104.io/authenticate', JSON.stringify({ email: username, password: password }), this.httpOptions)
.pipe(
map((response) => {
if (response.auth_token) {
localStorage.setItem('currentUser', JSON.stringify({ username: username, token: response.auth_token }));
this.loggedIn = true;
return response;
}
}),
import { Injectable } from '@angular/core';
import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor, HTTP_INTERCEPTORS } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/throw'
import 'rxjs/add/operator/catch';
@Injectable()
export class ErrorInterceptor implements HttpInterceptor {
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
// extract error message from http body if an error occurs
@larissaamancio
larissaamancio / terminalRspec
Created December 27, 2013 13:07
my error with Rspec
larissa@larissa-Lenovo-G550:~/diaspora$ rspec spec/models/user/user_professional_profile_spec.rb
No DRb server is running. Running in local process instead ...
/usr/lib/ruby/vendor_ruby/bundler/runtime.rb:216: warning: Insecure world writable dir /home/larissa/.rvm/bin in PATH, mode 040777
WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.9.1
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
=> Building fixtures
=> Built profiles.yml, aspect_memberships.yml, aspects.yml, people.yml, users.yml, and contacts.yml
Run options: exclude {:performance=>true}
1) UserProfessionalProfile validates the numericality of phone
Failure/Error: Unable to find matching line from backtrace