Skip to content

Instantly share code, notes, and snippets.

View shakdwipeea's full-sized avatar
🎯
Focusing

Akash Shakdwipeea shakdwipeea

🎯
Focusing
View GitHub Profile
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union
@shakdwipeea
shakdwipeea / makeFile
Created March 23, 2016 06:46
running dropwizard build
BASE_DIR = $(shell pwd)
JAVA_BIN = $(shell dirname $(shell which java))
$(if $(JAVA_BIN),,$(warning "Warning: No Java found in your path, this will probably not work"))
.PHONY: all
all: clean package start
clean:
@shakdwipeea
shakdwipeea / chunk.js
Last active July 23, 2016 07:34
Split array of objects
/**
* Split array
* @param arr[] The array to split
* @param startFn Start condition
* @param endFn End condition
*/
function chunk(arr, startFn, endFn) {
var chunks = [];
var chunk = [];
@shakdwipeea
shakdwipeea / ApiService.java
Last active August 4, 2019 18:19
Realm Cascade
package com.shakdwipeea.realmcascade;
import com.shakdwipeea.realmcascade.model.ModelA;
import retrofit2.Call;
import retrofit2.http.GET;
/**
* Created by ashak on 18-09-2016.
*/
@shakdwipeea
shakdwipeea / ContactPhotoDataToBitmap
Last active November 17, 2016 20:51
Load a contact photo thumbnail and return it as a Bitmap, resizing the image to the provided image dimensions as needed.
/**
*
* @param photoData photo ID Prior to Honeycomb, the contact's _ID value.
* For Honeycomb and later, the value of PHOTO_THUMBNAIL_URI.
* @return A thumbnail Bitmap, sized to the provided width and height.
* Returns null if the thumbnail is not found.
*/
private Bitmap loadContactPhotoThumbnail(String photoData) {
// Creates an asset file descriptor for the thumbnail file.
AssetFileDescriptor afd = null;
@shakdwipeea
shakdwipeea / profile.java
Created January 3, 2017 07:13
get high res picture from social profiles
/**
* used for fb AuthService provides Observables with gives the profile pic,
* this function uses that observable to display the profile pic
* @param profilePicObservable Observable that provides url for high res profile pic
*/
private void displayPic(Observable<String> profilePicObservable) {
profilePicObservable
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe(
@shakdwipeea
shakdwipeea / handler.clj
Created May 12, 2017 16:50
immutant async hander
(defn send-async-response [request async-handler]
(response/ok (:body (as-channel
request
{:on-open #(send! % (async-handler) {:close? true})}))))
@shakdwipeea
shakdwipeea / core.clj
Created July 5, 2017 12:32
walk through the fs and get all references of table from a database
(ns flow.core
(:gen-class)
(:require [clojure.string :as str]))
(require '[me.raynes.fs :as fs])
;; (php? "akash.clj")
;;;;;;;;;;;;;;;;;;;;;;;;
;; identify php files ;;
(:require [clojure.spec.alpha :as s])
(s/def ::id string?)
(s/def ::link uri?)
(s/def ::tag (s/and string?
(complement empty?)))
(s/def ::tags (s/coll-of ::tag
:distinct true))
@shakdwipeea
shakdwipeea / wheel.rkt
Created May 23, 2018 09:55
wheel movement
(require 2htdp/image)
(require 2htdp/universe)
(define background (empty-scene 200 50))
(define width-of-world 200)
(define radius-of-wheel 2)
(define distance-between-wheel (* radius-of-wheel 5))