Skip to content

Instantly share code, notes, and snippets.

@samlam
samlam / .bashrc
Last active February 13, 2021 14:46
Bash prompt (personal favorite)
alias python='/c/ProgramData/Anaconda3/python.exe -i'
alias proj="cd "~/Documents/Projects"
alias loop="cd "~/Documents/Projects/costarGit/loopnet-listing-web"
alias mdlint="markdownlint '**/*.md' &> mdlint.log"
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
exitstatus() {
@samlam
samlam / RendererSampleComponent.ts
Last active June 23, 2017 16:08
Angular 4+ Renderer2 example
import { Component,Renderer2 } from '@angular/core';
@Component({
selector:'app-root',
template:``
})
export class AppComponent{
value=true;
constructor(private renderer:Renderer2){
@samlam
samlam / umdwrapper.js
Last active June 17, 2017 19:28
Self-Executing Script IIFE with UMD Wrapper
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(factory);
} else if (typeof exports === 'object') {
module.exports = factory;
} else {
root.MYMODULE = factory();
}
})(this, function () {
// do your thing here

Keybase proof

I hereby claim:

  • I am samlam on github.
  • I am samlam (https://keybase.io/samlam) on keybase.
  • I have a public key whose fingerprint is 2583 1AD0 3C49 8536 CF2E 070E 261D C8B0 B4C2 B007

To claim this, I am signing this object:

@samlam
samlam / gist:3d89240e31170d2060b4
Last active August 29, 2015 14:01
SQL Xml datatype
Declare @Sizings XML
Select @Sizings = N'<Sizings><SDLC>Early Stage Analysis</SDLC><Estimate>10</Estimate></Sizings><Sizings><SDLC>Approach and Sizing</SDLC><Estimate>100</Estimate></Sizings>'
select
Estimate = a.b.value('Estimate[1]','numeric(18,6)')
,SDLC = a.b.value('SDLC[1]','nvarchar(500)')
from @Sizings.nodes('Sizings') a(b)
select convert(nvarchar(500),@Sizings.query('data(/Sizings/SDLC)') )
@samlam
samlam / gist:ade9138c3ac1410f88cb
Last active August 29, 2015 14:01
get business days
ALTER function [dbo].[udf_GetBusinessDays]
(
@startDate datetime
,@enddate datetime
)
RETURNS int
BEGIN
Declare @ret int
Set @ret = datediff(d,@startDate,@enddate)
- datediff(wk,@startDate,@enddate) * 2
if (!window.aiScope){
window.aiScope = scope;
window.aiContainer = this;
}
var ai = this.ai;
///setup and cached the func
if (!ai){
ai = this.ai = {};
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!--
this is a html bookmark file that can be imported into your browser.
-->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DL><p>
<DT><H3 ADD_DATE="1377883691" LAST_MODIFIED="1380210142">vs</H3>
<DL><p>
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!--
this is a html bookmark file that can be imported into your browser.
-->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DL><p>
<DT><H3 ADD_DATE="1377883691" LAST_MODIFIED="1380210142">vs</H3>
<DL><p>