Skip to content

Instantly share code, notes, and snippets.

@vijaytv
vijaytv / Carousel.tsx
Created February 5, 2024 01:04
carousel
//drag.js
import React from "react";
import autoBind from 'react-autobind';
import _ from "lodash";
import { Responsive, WidthProvider } from "react-grid-layout";
const ResponsiveReactGridLayout = WidthProvider(Responsive);
export default class DragFromOutsideLayout extends React.Component {
constructor(props) {
super(props);
@vijaytv
vijaytv / svg
Last active December 2, 2018 20:30
svg icon
<html>
<head>
<style>
body {
background-color: black;
}
</style>
<style>
.third {
@vijaytv
vijaytv / updatelist.js
Created September 10, 2018 02:44
Update list object by key (ramdajs)
var x = [{config: {a: 1}, w:1}, {config: {a: 2}, w:2}];
var y = 2;
const newConfig = {
config: {
b: 1,
a: 300 }
};
converge(
update,
@vijaytv
vijaytv / get-page.js
Last active March 28, 2018 00:30
Ramda Paging
var arr = [1,2,3,4,5,6,7,8,9,10];
var arr1 = [
{id: 1, url:'s'},
{id: 2},
{id: 3},
{id: 4},
{id: 5,url:'ss'}
]
@vijaytv
vijaytv / index.html
Last active June 2, 2017 02:33
html
<!DOCTYPE html>
<html>
<body>
<input id="city" value="Boston" placeholder="city"><br/>
<input id="plant" value="tulips" placeholder="plant"><br/>
<input id="soil" value="30%" placeholder="soil moisture" >
<br/>
<input type="button" value="Go" onclick="process()"/>
<div id="output">
</div>
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
from future.standard_library import install_aliases
install_aliases()
from urllib.parse import urlparse, urlencode
from urllib.request import urlopen, Request
from urllib.error import HTTPError
@vijaytv
vijaytv / largestrectinhistogram.js
Last active March 18, 2017 14:41
Find largest rectangle in Histigram
//Find the largest rectangle in a histogram.
var myList = [1,3,4,24,26,3,0,2,2,0,2,2,0,2,2,2,0,2,2,2];
function getLargestRect(arr) {
var result = arr.reduce(function(obj,item) {
if (item < 1) {
obj.runningItems = [];
return obj;
}
const selectProperties = pick
const data = {
awk: 'bla',
foo: 'bar',
doh: 'doh'
}
selectProperties(['nope'],data)
var diff = function(a, b) { return a - b; };
var inRange = unapply(pipe(
identity,
sort(diff),
prop(1)
))
inRange(600,12,120)
var notAbove = unapply(pipe(