Skip to content

Instantly share code, notes, and snippets.

💪
On learning spree!

Rahul Patil r4hulp

💪
On learning spree!
Block or report user

Report or block r4hulp

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@r4hulp
r4hulp / reclaimWindows10.ps1
Created Jan 15, 2019 — forked from alirobe/reclaimWindows10.ps1
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
View reclaimWindows10.ps1
##########
# Tweaked Win10 Initial Setup Script
# Primary Author: Disassembler <disassembler@dasm.cz>
# Modified by: alirobe <alirobe@alirobe.com> based on my personal preferences.
# Version: 2.20.2, 2018-09-14
# Primary Author Source: https://github.com/Disassembler0/Win10-Initial-Setup-Script
# Tweaked Source: https://gist.github.com/alirobe/7f3b34ad89a159e6daa1/
# Tweak difference:
#
# @alirobe's version is a subset focused on safely disabling telemetry, some 'smart' features and 3rd party bloat ...
@r4hulp
r4hulp / each.js
Last active Dec 11, 2018
JQuery reverse iteration
View each.js
for( i =  $('li').size(); i>= 0 ; i--){
$('li').eq(i).someSuperLogicHere;
}
@r4hulp
r4hulp / wp.css
Last active Dec 11, 2018
WP Shortcodes
View wp.css
.button_style{
display: inline-block;
font-size: 11px;
height: 19px;
margin: 5px 10px 5px 10px;
padding: 9px 13px 0;
text-decoration: none !important;
color:#fff !important;
line-height:11px;
background: #59595a;
@r4hulp
r4hulp / vm1.js
Last active Dec 11, 2018
Communication between multiple viewmodels
View vm1.js
var self = this;
self.firstName = ko.observable();
self.lastName = ko.observable();
self.fullName = ko.computed(function(){
return self.firstName + " " + self.lastName;
});
};
var viewModel2 = function(){
var self = this;
@r4hulp
r4hulp / custom-handler.cs
Last active Dec 11, 2018
Securing ASP.Net WebAPI, Gateway approach
View custom-handler.cs
CustomMessageHandler customMessageHandler = new CustomMessageHandler(){ InnerHandler = new HttpControllerHandler(config)};
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional },
constraints : null,
handler : customMessageHandler
);
View bxslider-display.php
<ul id="bxslider">
<?php if( have_posts() ) : while( have_posts() ) : the_post(); ?>
<!--Each post is wrapped in List item.. -->
<li>
<div class="thumbnail">
<?php
if(has_post_thumbnail()) { ?>
<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_post_thumbnail( 'thumbnail');?></a> <!-- Image links to Post -->
<?php } else { ?>
<div class="no-thumb"><h2>No thumbnail for this :D</h2><h3>wrapcode</h3></div>
@r4hulp
r4hulp / RootDialog.cs
Created Dec 29, 2017
Injecting parameters in Dialog
View RootDialog.cs
Dictionary<string, object> dict = new Dictionary<string, object>();
dict.Add("ticket_id", "this is string");
dict.Add("order", this.order);
context.Call(this.dialogFactory.Create<OrderSummaryDialog, Dictionary<string, object>>(dict), this.AfterOrderSummaryDialog);
@r4hulp
r4hulp / RootDialog.cs
Last active Dec 29, 2017
RootDialog calling other dialog using dialog factory
View RootDialog.cs
[Serializable]
public class RootDialog : IDialog<object>
{
private ConversationReference conversationReference;
private IDialogFactory dialogFactory;
public RootDialog(IDialogFactory dialogFactory)
{
this.dialogFactory = dialogFactory;
}
@r4hulp
r4hulp / DialogFactory.cs
Last active Dec 29, 2017
Dialog Factory
View DialogFactory.cs
public interface IDialogFactory
{
//constructor without dynamic params
T Create<T>();
//Constructor requiring multiple dynamic params
T Create<T>(IDictionary<string, object> parameters);
}
public class DialogFactory : IDialogFactory
{
@r4hulp
r4hulp / MessagesController.cs
Last active Dec 29, 2017
Bot Framework Messages Controller with DI
View MessagesController.cs
/// <summary>
/// POST: api/Messages
/// Receive a message from a user and reply to it
/// </summary>
public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
{
if (activity.Type == ActivityTypes.Message)
{
using (var scope = DialogModule.BeginLifetimeScope(Conversation.Container, activity))
{
You can’t perform that action at this time.