Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Emre KURT wemrekurt

💭
I may be slow to respond.
View GitHub Profile
@wemrekurt
wemrekurt / trie.rb
Created Jan 16, 2022
Ruby Trie data structure implementation
View trie.rb
class TrieNode
attr_accessor :children, :end_of_word, :parent
def initialize(parent)
self.children = {}
self.parent = parent
self.end_of_word = false
end
end
@wemrekurt
wemrekurt / upload_snap.js
Created Aug 4, 2019 — forked from Tamal/upload_snap.js
React Native File upload using XMLHttpRequest
View upload_snap.js
_uploadSnap() {
var url = 'http://example.com/upload'; // File upload web service path
var photo = {
uri: this.state.picturePath, // CameralRoll Url
type: 'image/jpeg',
name: 'photo.jpg',
};
var formData = new FormData();
formData.append("file", photo);
View import_spesific_cats_and_features.rb
def create_import(curr, files)
Category.create(curr)
subs = files.select { |i| i['parent_id'] == curr['id'] }
subs.each { |cat| create_import(cat, files) }
end
def create_features(cat, features)
fets = features.select do |i|
i['category_ids'] == cat.id
end
@wemrekurt
wemrekurt / dragfunction.js
Created Jan 27, 2019
Drag-drop file uploader
View dragfunction.js
$.fn.extend({
filedrop: function (options) {
var defaults = {
callback : null
}
options = $.extend(defaults, options)
return this.each(function() {
var files = []
var $this = $(this)
View google_drive_backup.rb
require "google_drive"
full_path = '/home/emrek/Desktop/Business/bafrahaber/public/'
session = GoogleDrive::Session.from_config("config.json")
files_path = full_path + Date.today.prev_day.strftime('%Y/%m/%d')
def root_path
#return 'Production' if Rails.env.production?
'Bafrahaber_dev'
end
@wemrekurt
wemrekurt / FrameLayout.java
Created Jun 3, 2018
java gui ortalama hesap
View FrameLayout.java
package com.gui;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
View assign2solution.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
void process_leaf(){
srand(getpid());
int r = rand()%100;
char filename[20];
sprintf(filename,"%d.txt",getpid());
printf("r num gen :%d by %d\n",r,getpid());
@wemrekurt
wemrekurt / backup.sh
Created Mar 7, 2017
MySQL Backup for Rails Apps (on Nginx)
View backup.sh
#!/bin/bash
today=`date +%Y-%m-%d_%H-%M`
for i in /etc/nginx/sites-enabled/*
do
if [ $i != "/etc/nginx/sites-enabled/default" ]
then
path=`cat $i | grep -w root | awk '{print $2}' | sed 's/\public;//g'`
path=$path"config/database.yml"
@wemrekurt
wemrekurt / Yildiz.c
Created Jun 15, 2016
Sesli harfleri yildiza ceviren program
View Yildiz.c
#include <stdio.h>
#define LEN 20
void converter(char *string){
int i = 0;
for (i; string[i] != '\0'; i++){
if(string[i] == 'a' || string[i] == 'e' || string[i] == 'u' || string[i] == 'U'){
string[i] = '*';
}
@wemrekurt
wemrekurt / TrimFull.c
Created Jun 15, 2016
Full temizleyen trim fonksiyonu. Gereksiz tum bosluklari siler
View TrimFull.c
#include <stdio.h>
enum StateType {NORMAL, INWORD};
/*
* ASCII Degerleri
* 46 = Nokta (.)
* 32 = Bosluk ( )
*/
int trim(){