Skip to content

Instantly share code, notes, and snippets.

View kucukkanat's full-sized avatar
⌨️
Working on http://remembrain.ai

HT kucukkanat

⌨️
Working on http://remembrain.ai
View GitHub Profile
@kucukkanat
kucukkanat / fileAPI.js
Last active August 29, 2015 14:05
File API get input value
$(document).on('change','#imageUpload',function(e){
var input = e.target;
var file = input.files[0];
var reader = new FileReader();
var dataURL = reader.readAsDataURL(file);
reader.onload = function(){
var src = reader.result;
$("#uImagePrev").css({"background-image":"url("+src+")"});
}
-- Turkce isimler sozlugu twitter : http://twitter.com/tserpico
CREATE TABLE `isimler` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`isimler` varchar(255) DEFAULT NULL,
`cinsiyet` varchar(255) DEFAULT NULL COMMENT 'erkek : E , kadın : K , uniseks : U',
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
-- ----------------------------
@kucukkanat
kucukkanat / distance.js
Last active January 27, 2018 22:21
Distance Finder
var getDistance = function(lat1,lon1,lat2,lon2){
var R = 6371; // km
//has a problem with the .toRad() method below.
var dLat = toRad(lat2-lat1);
var dLon = toRad(lon2-lon1);
var a = Math.sin(dLat/2) * Math.sin(dLat/2) +
Math.cos(toRad(lat1)) * Math.cos(toRad(lat2)) *
Math.sin(dLon/2) * Math.sin(dLon/2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
@kucukkanat
kucukkanat / redux.light.js
Last active May 30, 2018 13:13
A rewrite of redux
var _ = require('lodash');
var globalStore;
function getInstance(){
if (!globalStore) globalStore = createStore();
return globalStore;
}
@kucukkanat
kucukkanat / _utils.scss
Last active January 16, 2018 08:39
My utility CSS classes
.no {
&-padding {
padding: 0;
}
&-margin {
margin: 0
}
&-padding-top {
padding-top: 0
}
@kucukkanat
kucukkanat / promise.js
Created January 16, 2018 08:38
Manual implementation of Promise
function Promise(fn) {
var callback = null;
this.then = function(cb) {
callback = cb;
};
function resolve(value) {
// force callback to be called in the next
// iteration of the event loop, giving
// callback a chance to be set by then()
@kucukkanat
kucukkanat / keybase.md
Created April 12, 2019 22:23
Keybase proof

Keybase proof

I hereby claim:

  • I am kucukkanat on github.
  • I am kucukkanat (https://keybase.io/kucukkanat) on keybase.
  • I have a public key ASCm1o-xgZsrJZ_AbJZPuVb56E-XfAsyL8sOJttWQ2_69go

To claim this, I am signing this object:

@kucukkanat
kucukkanat / webpack.config.js
Created June 12, 2020 22:36
Webpack config for react libraries
// yarn add webpack webpack-cli typescript ts-loader mini-css-extract-plugin sass sass-loader style-loader css-loader
const path = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
devtool: "source-map", // any "source-map"-like devtool is possible
entry: path.resolve(__dirname, "src/index.tsx"),
output: {
path: path.resolve(__dirname, "dist"),
filename: "bundle.js",
@kucukkanat
kucukkanat / gist:2ffe1f04893168789e46f541fd5c954a
Last active November 21, 2020 20:06
glasscockpitbeta.json
{
"isEnabled": true,
"duration": 5
}
@kucukkanat
kucukkanat / gdown
Created October 10, 2021 16:00
Large file downloader from google drive
#!/usr/bin/env sh
export fileid=$1
export filename=$2
TEMP_CONFIRM_FILE=confirm.txt
TEMP_COOKIE_FILE=TEMP_COOKIE_FILE
## WGET ##
wget --save-cookies TEMP_COOKIE_FILE 'https://docs.google.com/uc?export=download&id='$fileid -O- \
| sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1/p' > ${TEMP_CONFIRM_FILE}