Skip to content

Instantly share code, notes, and snippets.

@bhattisatish
bhattisatish / gist:4378251
Created December 26, 2012 05:56
Is a function a constructor or not? Original src https://github.com/Benvie/Node.js-Ultra-REPL
function isConstructor(o){
return typeof o === 'function' // per ES spec any callable is typed 'function'
&& o.prototype != null // filter out absent prototypes
&& (typeof o.prototype === 'object' // filter out primitive prototypes
|| typeof o.prototype === 'function')
&& Object.getPrototypeOf(o) !== Object.prototype // filter out non-constructable DOM interfaces
&& Object.getOwnPropertyNames(o.prototype).length > // ensure the prototype has at least one property
{}.hasOwnProperty.call(o.prototype, 'constructor'); // ...besides 'constructor'
}
@bhattisatish
bhattisatish / gist:4378255
Created December 26, 2012 05:56
Is a function a constructor or not? Original src https://github.com/Benvie/Node.js-Ultra-REPL
function isConstructor(o){
return typeof o === 'function' // per ES spec any callable is typed 'function'
&& o.prototype != null // filter out absent prototypes
&& (typeof o.prototype === 'object' // filter out primitive prototypes
|| typeof o.prototype === 'function')
&& Object.getPrototypeOf(o) !== Object.prototype // filter out non-constructable DOM interfaces
&& Object.getOwnPropertyNames(o.prototype).length > // ensure the prototype has at least one property
{}.hasOwnProperty.call(o.prototype, 'constructor'); // ...besides 'constructor'
}
@bhattisatish
bhattisatish / pascal-nosenzo-v17.pde
Last active August 29, 2015 13:58
Processing file for generating ...
/*Original Source: http://www.reddit.com/r/processing/comments/221krp/thoughts_on_how_to_make_this/cginzbn */
float a;
void setup() {
size(800, 800);
rectMode(CENTER);
}
void draw() {
translate(width/2, height*0.4);
float[] pos = new float[50];
void setup(){
size(600,600, P3D);
for(int i = 0; i < pos.length; i++){
pos[i] = -100*i;
}
noFill();
}
void draw(){
background(92);
@bhattisatish
bhattisatish / EDI_Formatter
Created July 12, 2014 03:21
EDI Custom Plugin for Notepad++
<NotepadPlus>
<UserLang name="X12" ext="">
<Settings>
<Global caseIgnored="no" />
<TreatAsSymbol comment="no" commentLine="no" />
<Prefix words1="no" words2="no" words3="no" words4="no" />
</Settings>
<KeywordLists>
<Keywords name="Delimiters">000000</Keywords>
<Keywords name="Folder+"></Keywords>
@bhattisatish
bhattisatish / CertiRakefile
Created August 13, 2014 15:57
SSL Generation
desc "Generate a new key"
task :gen_key do
domain = get_env(:domain)
filename = "#{domain}.key"
next if File.exists? filename
`openssl genrsa -out #{filename} 2048`
end
desc "Generate a new CSR"

Keybase proof

I hereby claim:

  • I am bhattisatish on github.
  • I am satish (https://keybase.io/satish) on keybase.
  • I have a public key ASBBXKUSguu_TWoygpZwpYDomv53tobfK14YUKWlbueSZQo

To claim this, I am signing this object:

digraph {
node [shape=box, fontname=helvetica, fontsize=14]
edge [fontname=helvetica, fontsize=12]
rankdir=TB; pad=0.5; dpi=80;
// happy path
subgraph cluster_0 {
color=black; label="typical path"; fontname=helvetica
@bhattisatish
bhattisatish / index2html.sed
Last active December 21, 2023 10:05
Useful One-liners for sed
#!/usr/bin/sed -f
# index2html.sed - by Aurelio Jargas
# Get index.sed file and converts it to the main http://sed.sf.net page
#
1 i\
<html><head><title>sed.sf.net - The sed $HOME</title></head>\
<meta http-equiv="content-type" content="text/html; charset=utf-8">\
<body bgcolor="#ffffbb" text="black">\
<pre>