Skip to content

Instantly share code, notes, and snippets.

View rahulsivalenka's full-sized avatar

Phani Rahul Sivalenka rahulsivalenka

View GitHub Profile
@rahulsivalenka
rahulsivalenka / AddStringFormat_README.md
Last active June 14, 2016 19:26
Adding a String format function similar to C's printf to the String prototype and String object

String format function

Similar to C's printf()

Usage

Using prototype format function

"I'm the god damn {0}{1}".format("Batman", "!");
// returns I'm the god damn Batman!

Using String's format function

@rahulsivalenka
rahulsivalenka / CustomizeDefaultAutofillCSS.css
Created February 21, 2016 07:27
To customize default autofill colors of a browser
input:-webkit-autofill {
-webkit-box-shadow: 0 0 0 1000px #466f92 inset;
transition: background-color 5000s ease-in-out 0s;
}
input[type=text],
input[type=password] {
background: #466f93 !important;
}
@rahulsivalenka
rahulsivalenka / GeneralSassMixins.md
Last active June 14, 2016 19:26
General Sass Mixins with cross-browser css

General Sass Mixins

With cross-browser CSS

Contains general SASS mixins for most used cross-browser CSS styles.

Mixins defined so far
  1. With arguments
    • translate2d
    • opacity
@rahulsivalenka
rahulsivalenka / AppPrefixing.scss
Last active June 14, 2016 19:26
Common prefix for all CSS classess for an app using sass variable
// prefix that needs to be attached to all the css classes
$prefix: app-;
// that variable can be used as #{$prefix} to attach that prefix to every class
.#{$prefix}header {
background: red;
}
.#{$prefix}content {
background: yellow;
@rahulsivalenka
rahulsivalenka / SwitchCaseConditions.js
Created April 17, 2016 05:32
Using conditions in switch stament
var cnt = 15;
switch(true) {
case cnt < 0:
console.log('We r at a loss!');
break;
case cnt > 0:
console.log('Somethin in it!');
break;
default:
@rahulsivalenka
rahulsivalenka / git-feature-workflow.md
Created July 23, 2016 04:56 — forked from blackfalcon/git-feature-workflow.md
Git basics - a general workflow

There are many Git workflows out there, I heavily suggest also reading the atlassian.com [Git Workflow][article] article as there is more detail then presented here.

The two prevailing workflows are [Gitflow][gitflow] and [feature branches][feature]. IMHO, being more of a subscriber to continuous integration, I feel that the feature branch workflow is better suited.

When using Bash in the command line, it leaves a bit to be desired when it comes to awareness of state. I would suggest following these instructions on [setting up GIT Bash autocompletion][git-auto].

Basic branching

When working with a centralized workflow the concepts are simple, master represented the official history and is always deployable. With each now scope of work, aka feature, the developer is to create a new branch. For clarity, make sure to use descriptive names like transaction-fail-message or github-oauth for your branches.

@rahulsivalenka
rahulsivalenka / OpenWithSublimeText3.bat
Created August 31, 2016 04:48 — forked from roundand/OpenWithSublimeText3.bat
Open folders and files with Sublime Text 3 from windows explorer context menu (tested in Windows 7)
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@rahulsivalenka
rahulsivalenka / index.js
Last active October 26, 2016 12:41
requirebin sketch
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
var Q = require('q');
var formatStr = function(str) {
var args = Array.prototype.slice.call(arguments, 1);
return str.replace(/{(\d+)}/g, function(match, number) {
return typeof args[number] != 'undefined'
? args[number]
@rahulsivalenka
rahulsivalenka / index.html
Last active November 23, 2016 09:02 — forked from anonymous/index.html
Draw an arc in SVG using path
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
svg {
height: 1000px;
width: 1000px;
@rahulsivalenka
rahulsivalenka / Fragments.cs
Created November 29, 2016 11:42 — forked from followthatleader/Fragments.cs
Presenters in MvvmCross: Navigating Android with Fragments (Greg Shackles)
// Greg's awesome article had broken syntax highligting, leading to unreadable code :( So I fixed it up here,
// putting it on a Gist for myself and for others. Here's the original article:
// http://www.gregshackles.com/presenters-in-mvvmcross-navigating-android-with-fragments/
// First let's quickly set up the basic app essentials here, starting with the view models:
using Cirrious.MvvmCross.ViewModels;
namespace PresenterDemo.Core.ViewModels
{