Skip to content

Instantly share code, notes, and snippets.

@OndeVai
OndeVai / mac and bash samples
Last active December 4, 2018 20:37
Mac/Bash Cheatsheet
//delete folder terminal
git rm -rf [folder]
//show hidden files in finder
CMD + SHIFT + .
//view one or more file contents
cat [file1.ext] [file2.ext]
//tail logs (get only the tail end of log file)
@OndeVai
OndeVai / AWS Cheatsheet
Last active November 27, 2018 04:52
aws-samples
//cli
//cognito
--create a user
aws cognito-idp sign-up \
--region REGION \
--client-id APP_CLIENTID \
--username APPUSERNAME/EMAIL \
--password PASSWORD
@OndeVai
OndeVai / Git-samples
Created November 16, 2018 03:56
Git cheatsheet
//create a new repository on the command line
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/OndeVai/temp-docker-microservices.git
git push -u origin master
//push an existing repository from the command line
git remote add origin https://github.com/OndeVai/temp-docker-microservices.git
Install
--Mac: use homebrew
Running
--1: Run the server (terminal) - mongod --dbpath /Users/[some path] (dbpath needed for Mac becuase can't access /data/be)
Node Client
--for an API you have the choice over Mongoose (a more complex but structured "ORM") or mongodb native (more like the CLI)
--https://www.npmjs.com/package/mongoose
--https://www.npmjs.com/package/mongodb
@OndeVai
OndeVai / Docker-samples
Last active November 17, 2018 01:20
Docker cheatsheet
//common docker issues
http://www.pogsdotnet.com/2018/08/common-nodejs-docker-issues.html
//List all containers (only IDs)
docker ps -aq.
//Stop all running containers.
docker stop $(docker ps -aq) -f //-f is force and optional
//Remove all containers.
@OndeVai
OndeVai / paging
Last active October 23, 2018 19:07
var skip = (pageNumber - 1) * pageSize;
return
_context.Authors
.OrderBy(a => a.FirstName)
.ThenBy(a => a.LastName)
.Skip(skip)
.Take(pageSize)
.ToList();
USE [PMROEM_Sitefinity]
GO
/****** Object: StoredProcedure [dbo].[FindGUID] Script Date: 11/15/2017 2:57:58 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[FindGUID] @searchValue uniqueidentifier AS
/*
@OndeVai
OndeVai / angular-number-of-watchers.js
Last active August 27, 2015 18:09
Angular - Get number of watchers
var getWatchers = function (element) {
// convert to a jqLite/jQuery element
// angular.element is idempotent
var el = angular.element(
// defaults to the body element
element || document.getElementsByTagName('body')
)
// extract the DOM element data
, elData = el.data()
// initalize returned watchers array
@OndeVai
OndeVai / gist:8676155d9e4c3ccea13f
Created June 27, 2014 17:06
create html helper in code
Helper = new HtmlHelper<T>(new ViewContext(controllerContext, new FakeView(), viewData, tempData, System.IO.TextWriter.Null), new ViewPage());
@OndeVai
OndeVai / gist:9c627f123dab063f3d21
Created June 27, 2014 17:01
get full mvc field name for property
var exp = ExpressionHelper.GetExpressionText(expression);
Html.ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldName(_ExpressionText)