Skip to content

Instantly share code, notes, and snippets.

declare @param varchar(50)
set @param='PNS,PNR,PUG'
declare @value varchar(50)
set @value='PNR'
select 'yes' as [contains] where charindex(',' + @value + ',', ',' + @param + ',', 0) > 0
/*
loop-sample.cpp
*/
#include <iostream>
using namespace std;
/*
# Build with the following command
@cshtdd
cshtdd / amazon-affiliate-bookmark
Created April 22, 2015 02:52
bookmark to generate amazon affiliate links
javascript:
var affiliateId = "YOUR_AFFILIATE_ID";
var l = window.location.href;
var urlPieces = l.split("/");
var productId = getProductId("dp");
if (!productId){
productId = getProductId("product");
}
// Photoshop Script to Create iPhone Icons from iTunesArtwork
//
// WARNING!!! In the rare case that there are name collisions, this script will
// overwrite (delete perminently) files in the same folder in which the selected
// iTunesArtwork file is located. Therefore, to be safe, before running the
// script, it's best to make sure the selected iTunesArtwork file is the only
// file in its containing folder.
//
// Copyright (c) 2010 Matt Di Pasquale
// Added tweaks Copyright (c) 2012 by Josh Jones http://www.appsbynight.com
# read http://peterdowns.com/posts/first-time-with-pypi.html
# make sure to have a ~/.pypirc configured with users and passwords
# go to the package folder
# publish package to test pypi
python setup.py register -r pypitest
python setup.py sdist upload -r pypitest
# publish package to live pypi
python setup.py register -r pypi
@cshtdd
cshtdd / scala-unstable-identifiers.scala
Last active August 11, 2016 11:40
scala-unstable-identifiers
//paste the contents of this file on a scala console and inspect the results
abstract class Token
case class TNum(n: Double) extends Token
case class TOpenP() extends Token
case class TCloseP() extends Token
case class TSum() extends Token
case class TDiff() extends Token
case class TMult() extends Token
case class TDiv() extends Token

Keybase proof

I hereby claim:

  • I am camilin87 on github.
  • I am camilin87 (https://keybase.io/camilin87) on keybase.
  • I have a public key ASA2JSY3LscaDn6Gr37cqH1qa4D_ZRzo0ecfvcDwZAk1YAo

To claim this, I am signing this object:

@cshtdd
cshtdd / jasmine-before-each-call-order
Created August 5, 2014 19:05
explain the order in which beforeEach gets called in Jasmine and the test variables scope
describe("jasmine class variables", function() {
var foo = 0;
beforeEach(function() {
foo += 1;
});
it("can be assigned in the before each", function() {
expect(foo).toEqual(1);
});
@cshtdd
cshtdd / setup_elastic_search_java.sh
Created January 16, 2019 12:04
Setup all the Java versions Elastic Search needs to compile
#!/bin/bash
# desired java versions
JAVA_VERSION_11=11.0.1-open
JAVA_VERSION_10=10.0.2-open
JAVA_VERSION_9=9.0.4-open
JAVA_VERSION_8=8.0.192-zulu
import signal
class InterruptableRegion(object):
def __init__(self, sig=signal.SIGINT):
self.sig = sig
self.interrupted = False
self.released = False
self.original_handler = None
def __enter__(self):