Skip to content

Instantly share code, notes, and snippets.

View vivekrk's full-sized avatar
🎯
Focusing

Vivek Kundapur vivekrk

🎯
Focusing
View GitHub Profile
@vivekrk
vivekrk / Command.java
Created September 2, 2012 04:15
A simple undo manager implementation using command pattern
package com.vravindranath.undosample;
public interface Command {
public static final String UNDO = "undo";
public static final String REDO = "redo";
public void execute(String command);
}
@vivekrk
vivekrk / effect.js
Created September 14, 2012 18:09
greyscale conversion in canvas
console.log('I am here');
var ctx = null;
//Converts the bitmap array to greyscale and returns the modified array
function applyGreyScaleEffect(ctx) {
console.log('applyGreyScaleEffect');
var start = new Date().getTime();
var recall = {};
var imageData = ctx.getImageData(0,0,2048,1536);
@vivekrk
vivekrk / timer.js
Created October 19, 2012 15:06
A simple timer sample in javascript
function Timer () {
var i = 1;
var timer = setInterval(function() {
console.log(i);
i++;
if(i > 10) {
clearInterval(timer);
}
}, 1000);
}
// THIS IS A BETA! I DON'T RECOMMEND USING IT IN PRODUCTION CODE JUST YET
/*
* Copyright 2012 Roman Nurik
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
@vivekrk
vivekrk / Expiry.java
Last active August 29, 2015 14:06
Hard coded expiry
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
NotificationManager.getInstance().addObserver(loginSucess.name(), this);
if (isExpired()) {
AlertDialog alertDialog = new AlertDialog.Builder(this)
.setTitle("Expired")
.setCancelable(false)
.setMessage("This Build has expired!")
module.exports = {
/**
*
* Using raw socket.io functionality from a Sails.js controller
*
*/
index: function (req,res) {
@vivekrk
vivekrk / build_android.sh
Last active August 29, 2015 14:07
FFMPEG Android build script
#!/bin/bash
echo " _ __ _ __ _ "
echo " | | / / (_) / /_ ____ _ ____ ___ (_) ___ "
echo " | | / / / / / __/ / __ \/ / __ __ \ / / / __ \ "
echo " | |/ / / / / /_ / /_/ / / / / / / / / / / /_/ / "
echo " |___/ /_/ \__/ \____/ /_/ /_/ /_/ /_/ \____/ "
echo " "
# export ANDROID_NDK=
@vivekrk
vivekrk / git.migrate
Created October 1, 2016 05:41 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@vivekrk
vivekrk / User.js
Created March 13, 2017 04:29
User.js
attributes: { 
firstname’: { 
type: ‘string’,
 required: true 
},
 ‘lastname’: { 
type: ‘string’ 
},
 ‘email’: { 
type: ‘email’,