Skip to content

Instantly share code, notes, and snippets.

View asleepysamurai's full-sized avatar

Balaganesh Damodaran asleepysamurai

View GitHub Profile
@asleepysamurai
asleepysamurai / bootstrap.tooltip.js
Created October 29, 2012 07:32
Bootstrap tooltip plugin - modified to be rendered within the viewport and not runoff. Added a placement option 'auto' which determines the correct placement depending on viewport size. If suitable space is not available on any side of the element, then t
/* ===========================================================
* bootstrap-tooltip.js v2.1.1
* http://twitter.github.com/bootstrap/javascript.html#tooltips
* Inspired by the original jQuery.tipsy by Jason Frame
* ===========================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@asleepysamurai
asleepysamurai / plv8-install-ubuntu.md
Created June 1, 2013 15:56
Install plv8 on Ubuntu
  1. Install and configure Postgres [https://library.linode.com/databases/postgresql/ubuntu-12.04-precise-pangolin]
  2. Download latest stable version of plv8 [https://code.google.com/p/plv8js/wiki/PLV8]
  3. Extract plv8.zip and cd into it.
  4. sudo apt-get install subversion
  5. sudo make static
  6. Copy plv8.so to /usr/lib/postgres/9.1/lib
  7. Copy plv8--(version).sql and plv8.control to /usr/share/postgres/9.1/extension
  8. psql -d dbName
  9. CREATE EXTENSION plv8;
  10. Repeat 6-8 for plls (livescript) and plcoffee (coffeescript) if required
@asleepysamurai
asleepysamurai / bows-custom-inspect.js
Created January 31, 2016 17:17
Bows - custom inspect method for printing time diff
(function() {
function checkColorSupport() {
if (typeof window === 'undefined' || typeof navigator === 'undefined') {
return false;
}
var chrome = !!window.chrome,
firefox = /firefox/i.test(navigator.userAgent),
firefoxVersion;
if (firefox) {
@asleepysamurai
asleepysamurai / TodoContainer.js
Created March 9, 2019 05:32
TodoContainer Class Component
/**
* Todo Root Container Component
*/
import React, { Component } from 'react';
import TodoItem from './TodoItem';
import TodoInput from './TodoInput';
class Todo extends Component {
constructor(props) {
@asleepysamurai
asleepysamurai / TodoInput.js
Created March 9, 2019 05:34
TodoInput Class Component
/**
* TodoInput Component
*/
import React, { Component } from 'react';
class TodoInput extends Component {
constructor(props) {
super(props);
@asleepysamurai
asleepysamurai / TodoItem.js
Created March 9, 2019 05:34
TodoItem Class Component
/**
* TodoItem Component
*/
import React, { Component } from 'react';
class TodoItem extends Component {
constructor(props) {
super(props);
@asleepysamurai
asleepysamurai / useStateSig.js
Created March 9, 2019 05:36
useState Signature
const [value, setValue] = useState(initialValue);
@asleepysamurai
asleepysamurai / TodoInput.js
Created March 9, 2019 05:36
TodoInput useState
/**
* TodoInput Component
*/
import React, { useState } from 'react';
function TodoInput({
onAdd
}) {
const [text, setText] = useState('');
@asleepysamurai
asleepysamurai / useCallbackSig.js
Created March 9, 2019 05:37
useCallback signature
const memoizedFunction = useCallback(inlineFunctionDefinition, memoizationArguments);
@asleepysamurai
asleepysamurai / TodoInput.js
Created March 9, 2019 05:38
TodoInput Function Component
/**
* TodoInput Component
*/
import React, { useState, useCallback } from 'react';
function TodoInput({
onAdd
}) {
const [text, setText] = useState('');