Skip to content

Instantly share code, notes, and snippets.

View IAMIronmanSam's full-sized avatar
🎯
Focusing

Tony Stark IAMIronmanSam

🎯
Focusing
View GitHub Profile
@IAMIronmanSam
IAMIronmanSam / linkedList.js
Last active January 9, 2019 07:08
Simple implementation on linked list in JS
function Node(data) {
this.data = data;
this.next = null;
}
function SinglyList() {
this._length = 0;
this.head = null;
}
@IAMIronmanSam
IAMIronmanSam / stringInt.js
Created February 1, 2018 19:51
String Interpulation
var stringInt = {};
var name = "Tony Stark";
stringInt.variable(() => {
console.log(`Yo, ${name}!`);
});
stringInt.method(() => {
console.log(`Hey, ${this.iamMethod(name)}!`);
});
@IAMIronmanSam
IAMIronmanSam / notnot.js
Created June 12, 2017 21:03
Check for Undefined & NULL
var ironman;
if(ironman){ // Check Declaration
console.log('Defined and has value');
}
if(!ironman){ // Check for null
console.log('Defined and has null value');
}
if(!!ironman){ //Check for Null & Defined
console.log('Defined and not empty');
}
@IAMIronmanSam
IAMIronmanSam / JSLinkTemplate.js
Last active January 17, 2017 02:32
Simple JSLink Template
/*
Add clienttemplates.js reference in master page
<script type="text/javascript">RegisterSod("clienttemplates.js", "/_layouts/15/clienttemplates.js");</script>
*/
(function () {
SPClientTemplates.TemplateManager.RegisterTemplateOverrides({
Templates: {
Header: "<div class='col-md-12'>",
Body: function (ctx) {
for(var v in ctx.ListData.Row){
@IAMIronmanSam
IAMIronmanSam / tensorflow.py
Created October 7, 2016 21:40
Image Classifier
#Deplo tensorflow image in docker
sudo docker run -it gcr.io/tensorflow/tensorflow:latest-devel
#Copy Image Set-
sudo docker run -it -v /home/arivu/MyWorld/tensorflow/tf_files/starwars:/tf_files/starwars gcr.io/tensorflow/tensorflow:latest-devel
#Re-Train model
python /tensorflow/tensorflow/examples/image_retraining/retrain.py \
--bottleneck_dir=/tf_files/bottlenecks \
--how_many_training_steps 500 \
@IAMIronmanSam
IAMIronmanSam / pem2cer.sh
Created September 9, 2016 23:31
.PEM to .CER using openssl
openssl x509 -inform PEM -in cacert.pem -outform DER -out certificate.cer
@IAMIronmanSam
IAMIronmanSam / getFieldColumns.js
Created July 29, 2016 19:08
Get field types & field name from list
function GetFieldsForList(Site, ListName)
{
var ctx = new SP.ClientContext(Site);
var list = ctx.get_web().get_lists().getByTitle(ListName);
this.fields = list.get_fields();
ctx.load(fields, 'Include(Title,InternalName,FieldTypeKind)');
ctx.executeQueryAsync(Function.createDelegate(this, this.Success), Function.createDelegate(this, this.Failure));
}
function Success()
@IAMIronmanSam
IAMIronmanSam / modalGen.js
Created July 24, 2016 20:45
Bootstrap modal dialog generator
function bootstrapModelDialog(id, title, body, buttons) {
try {
if (!document.getElementById(id)) {
var innerHtml = "<div class=\"modal fade\" id=\"" + id + "\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"basicModal\" aria-hidden=\"true\"><div class=\"modal-dialog\"><div class=\"modal-content\"><div class=\"modal-header\"><button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">&times;</button><h2 class=\"modal-title\" id=\"myModalTitle\">" + title + "</h2></div><div class=\"modal-body\" id=\"modalBody\">" + body + "</div><div class=\"modal-footer\" id=\"modalFooter\">" + buttons + "</div></div></div></div>";
$("body").append(innerHtml);
$('#' + id).modal('show');
} else {
$('#myModalTitle').html(title);
$('#modalBody').html(body);
$('#modalFooter').html(buttons);
@IAMIronmanSam
IAMIronmanSam / loader.html
Created July 7, 2016 23:12
Simple bootstrap loader
<!--Requires Bootstrap CSS & JS -->
<div id="loading_Modal" class="modal fade" tabindex="-1" role="dialog" data-keyboard="false"
data-backdrop="static">
<div class="modal-dialog" style="width:400px;top:30%;">
<div class="modal-content">
<div class="modal-header" style="padding: 0px; text-align: center;">
<h2 style="margin-top: 5px;">Please wait ....</h2>
</div>
<div class="modal-body" >
<div style="height:20px">
@IAMIronmanSam
IAMIronmanSam / CAMLGetListItems.js
Last active June 29, 2016 19:42
Get List items by CAML query
function CAMLGetListItems(SPHostUrl,listTitle,query){
var SPContext = new SP.ClientContext.get_current(SPHostUrl);
var web = SPContext.get_web();
var List = web.get_lists().getByTitle(listTitle);
var listItems;
var query = new SP.CamlQuery(query);
query.set_viewXml(query);
listItems = List.getItems(query);
SPContext.load(listItems);