Skip to content

Instantly share code, notes, and snippets.

import { Component, NgModule, OnInit } from '@angular/core';
import { Pipe, PipeTransform } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import _ from 'lodash';
@Pipe({name: 'Search'})
export class SearchService implements PipeTransform {
transform(obj: any, term) {
if (obj != null && term) {
@nathandaly
nathandaly / .gitignore
Created December 7, 2017 12:36 — forked from cebe/.gitignore
script to mirror svn repository
# subversion
.subversion
# mirror dirs
/mirror/*
/tmp/*
@nathandaly
nathandaly / svn-to-git-sync.sh
Last active January 2, 2018 16:04
Script to automate SVN to Git synchronization.
#!/bin/bash
fetchAndRebase=true
retryfetch=false
commitToRefetchFrom=null
currentDateTime=`date '+%Y-%m-%d %H:%M:%S'`
# Check for any flags
while [ ! $# -eq 0 ]
do
case "$1" in
@nathandaly
nathandaly / slack-delete.php
Last active January 17, 2018 02:45
Slack direct message delete
<?php
require_once './vendor/autoload.php';
use GuzzleHttp\Pool;
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;
$apiUrl = 'https://slack.com/api/'; // API URL.
$apiToken = 'xoxp-xxxx-xxxx-xxxx-xxxx'; // Slack Legacy API Token.
@nathandaly
nathandaly / remove-php.sh
Created February 16, 2018 23:09
Ubuntu: Remove PHP version specified.
sudo apt-get purge `dpkg -l | grep php7. | awk '{print $2}' |tr "\n" " "`
@nathandaly
nathandaly / FetchWeather.js
Created February 28, 2018 21:28
.NET Core React fetching data example.
import * as React from 'react';
import { RouteComponentProps } from 'react-router';
import 'isomorphic-fetch';
interface FetchDataExampleState {
forecasts: WeatherForecast[];
loading: boolean;
}
export class FetchData extends React.Component<RouteComponentProps<{}>, FetchDataExampleState> {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using CryptoCoins;
using CryptoMarkets;
namespace CryptoMarkets
@nathandaly
nathandaly / mac-settings.json
Last active March 30, 2018 21:36
VSCode Settings
{
"csharp.format.enable": false,
"workbench.iconTheme": "vscode-icons",
"files.exclude": {
".idea/": true
},
"terminal.external.osxExec": "iTerm.app",
"terminal.explorerKind": "external",
// The number of spaces a tab is equal to. This setting is overriden
// based on the file contents when `editor.detectIndentation` is true.
@nathandaly
nathandaly / parsejson.nim
Last active April 4, 2018 17:39
Parse JSON
import json, tables, osproc, strutils
type Services = JsonNode
proc readConfig(): Services =
result = parseFile("services.json")
when isMainModule:
var services: Services = readConfig()
@nathandaly
nathandaly / vagrant-scp
Last active May 31, 2018 10:23 — forked from mykter/vagrant-scp
Copy a file between a Vagrant VM and the host with scp
#!/bin/sh
# Change these settings to match what you are wanting to do
FILE=/File/To/Copy
PATH=/Where/To/Put/File
OPTIONS=`vagrant ssh-config | awk -v ORS=' ' 'NF{print "-o " $1 "=" $2}'`
# To copy a file from a Vagrant VM to the host:
# scp -rp ${OPTIONS} v:/srv /srv