Skip to content

Instantly share code, notes, and snippets.

View kishanio's full-sized avatar
🐈
C for Cat.

Kishan Thobhani kishanio

🐈
C for Cat.
  • Indie Solo Dev.
  • Tropical West Coast of India (Mostly)
View GitHub Profile
@kishanio
kishanio / Spotify Like Image Masonry.html
Last active August 29, 2015 14:25
Spotify Like Image Masonry
<!-- Import jquery.js & masonry.js -->
<script src="js/libs/jquery.js"></script>
<script src="js/libs/masonry.js"></script>
<!-- Create empty container -->
<div class="masonry"></div>
<!-- Call the function -->
@kishanio
kishanio / application_controller.rb
Last active August 29, 2015 14:25
CCAvenue Ruby GEM Usage
# application_controller.rb
# Create an instance with merchantid, workingkey and redirect url as parameter
def ccavenue
return @ccavenue = Ccavenue::Payment.new(<TODO: MERCHANT ID>,<TODO: MERCHANT WORKING KEY>,<TODO: REDIRECT URL>)
end
@kishanio
kishanio / pay.php
Last active July 7, 2022 05:43
CCAvenue PHP Library
<?php
require_once __DIR__ . '/../vendor/autoload.php';
use Kishanio\CCAvenue\Payment as CCAvenueClient;
$ccavenue = new CCAvenueClient( '<merchant_id>', '<working_key>', '<redirect_url>' );
// set details
$ccavenue->setAmount( '<Amount>' );
$ccavenue->setOrderId( '<order_id>' );
@kishanio
kishanio / # openni2 - 2016-07-11_19-46-27.txt
Created July 11, 2016 14:26
openni2 (homebrew/science/openni2) on Mac OS X 10.11.5 - Homebrew build logs
Homebrew build logs for homebrew/science/openni2 on Mac OS X 10.11.5
Build date: 2016-07-11 19:46:27
@kishanio
kishanio / parse_promises_series.js
Created April 20, 2017 06:05
Parse : Chaining Promises in Series
// File : utils/api.js
var Api = {};
Api.NewNote = function(note,file) {
var file = new Parse.File(file.name, file);
return file.save().then(function(file) {
var promise = Parse.Promise.as();
promise = promise.then( function() {
var NewNote = new Note();
@kishanio
kishanio / parse_promises_parallel.js
Last active May 2, 2017 02:12
Parse : Chaining Promises
// Parse : Chaining Promises in Parallel
// File : utils/api.js
var Api = {};
Api.Count = function() {
var promises = [];
var shelf = new Parse.Query(Shelf);
var note = new Parse.Query(Note);
var book = new Parse.Query(Book);
@kishanio
kishanio / parse_cloud_code_aftersave_trigger.js
Created May 2, 2017 02:06
Parse Cloud Code afterSave trigger
Parse.Cloud.afterSave("Book", function(request, response) {
var book = request.object;
var Shelf = Parse.Object.extend("Shelf");
var query = new Parse.Query(Shelf);
query.get(book.get("shelf").id).then(function(shelf) {
shelf.increment("bookCount");
shelf.save();
});
@kishanio
kishanio / pure_function.js
Last active May 2, 2017 08:09
Redux : Pure vs Impure Function
// Pure Function
function square(x) {
return x * x;
}
function squareAll(items) {
return items.map(square);
}
// Impure Function
@kishanio
kishanio / reducer_example.js
Created May 2, 2017 08:34
Redux : Reducer Function Example
// Reducer for counter.
// Dependency : https://github.com/mjackson/expect
// handles default state
const counter = ( state = 0, action) => {
switch( action.type ) {
case 'INCREMENT':
return state+1;
case 'DECREMENT':
return state-1;
@kishanio
kishanio / redux_store.js
Last active May 4, 2017 11:21
Redux : Store
// Dependency : http://redux.js.org/
const { createStore } = Redux;
const counter = ( state = 0, action) => {
switch( action.type ) {
case 'INCREMENT':
return state+1;
case 'DECREMENT':
return state-1;
// handles undefined action