Skip to content

Instantly share code, notes, and snippets.

View nivesh2's full-sized avatar
🎯
Focusing

Nivesh Singh nivesh2

🎯
Focusing
View GitHub Profile
@nivesh2
nivesh2 / How to get current accent color
Created April 26, 2013 13:16
detect Theme in Windows Phone app
//Accent color is given by PhoneAccentColor ressource. Its type is System.Windows.Media.Color
using System.Windows.Media;
Color AccentColor()
{
return (Color)Application.Current.Resources["PhoneAccentColor"];
}
//To make a TextBlock theme-aware use the Style property
<TextBlock Style="{StaticResource PhoneTextAccentStyle}"/>
@nivesh2
nivesh2 / Web.config Nodejs Azure
Last active December 21, 2015 07:09
Node.js Web.config file required for rendering json and other static content when hosted in Azure
<configuration>
<system.webServer>
<!-- indicates that the server.js file is a node.js application
to be handled by the iisnode module -->
<handlers>
<add name="iisnode" path="server.js" verb="*" modules="iisnode" />
</handlers>
@nivesh2
nivesh2 / Sliding list
Last active December 21, 2015 16:19
Dynamic sliding list, using javascript and jquery. It fetches content for the list from the web API.
(function() {
var target = "";
var $search = $('#search');
var $input = $('#target');
//sliding list
$(document).on('mouseenter', 'dt', function() {
$(this)
.next()
.slideDown(200)
(function() {
var target = "";
var $search = $('#search');
var $input = $('#target');
$(document).on('click','button.close',function() {
var name= '#'+ $(this).attr('name');
@nivesh2
nivesh2 / old search code
Last active December 21, 2015 17:49
hotel search API code Node.js
exports.findhotel = function(req, res) {
var q = [];
var flag = 0;
var queryString = req.query.id;
var idx = hotel_array.state.indexOf(queryString);
while (idx != -1) {
flag = 1;
q.push(hotel[idx]);
idx = hotel_array.state.indexOf(queryString, idx + 1);
@nivesh2
nivesh2 / change URL with out reloading the page
Created August 26, 2013 21:31
i have used the window.history.push('object name','title ','url to be displayed '), this is also helpful in creating the history without navigating to other pages or updating the url.
window.onpopstate = function(e) {
console.log("onpopstate called");
if (e.state) {
console.log('going back');
$('#search-type').text(e.state.text);
target = e.state.target;
console.log("target: "+target);
if (target == "home") {
@nivesh2
nivesh2 / google place search via text
Created August 28, 2013 03:32
only required fields are map center (lat,lng) and query (name and address)
<!DOCTYPE html>
<html>
<head>
<title>Place searches</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<link href="default.css" rel="stylesheet">
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=true&libraries=places"></script>
<script>
@nivesh2
nivesh2 / hotel image like profile image
Last active December 22, 2015 00:28
hotelSquare.js
(function() {
var target = $('.target').val();
var $search = $('#search');
var $input = $('input:text');
var obj;
var url_obj = {};
var url_flag = true;
$(document).on('click', 'button.close', function() {
#heart {
margin-top: -10px;
margin-left: 3px;
-webkit-animation: heartPulse 2s ease-out infinite;
image-rendering: -webkit-optimize-contrast;
}
@-webkit-keyframes heartPulse {
0% {
-webkit-transform-origin: 50% 100%;
-webkit-transform: scale(1);
#include <stdio.h>
#define MAX 15
void f(int a[],int l){
int i,tail;
tail=0;
for(i=0;i<l;i++){
if(a[i]==0){continue;}