Skip to content

Instantly share code, notes, and snippets.

Avatar

Fırat KÜÇÜK firatkucuk

View GitHub Profile
@firatkucuk
firatkucuk / rest-endpoint-standards.md
Created Jul 5, 2019
REST Endpoint standards for single page applications.
View rest-endpoint-standards.md

Backend:

GET     /api/some-resource/{uuid}               Get Detail of single resource
POST    /api/some-resource                      Create resource with incoming data
PUT     /api/some-resource/{uuid}               Update resource with incoming data
DELETE  /api/some-resource/{uuid}               Delete resource
GET     /api/some-resources                     List all resources with post data

XXXX    /api/some-resource/{uuid}/some-action   Perform some action for that specified resource
@firatkucuk
firatkucuk / delete-slack-messages.js
Last active Dec 17, 2021
Deletes slack public/private channel messages, private chat messages and channel thread replies.
View delete-slack-messages.js
#!/usr/bin/env node
// Channel ID is on the the browser URL.: https://mycompany.slack.com/messages/MYCHANNELID/
// Pass it as a parameter: node ./delete-slack-messages.js CHANNEL_ID
// CONFIGURATION #######################################################################################################
const token = 'SLACK TOKEN';
// Legacy tokens are no more supported.
// Please create an app or use an existing Slack App
@firatkucuk
firatkucuk / decimal-to-hex.java
Created Jun 12, 2017
Try to convert arbitrary length string decimal to string hexadecimal
View decimal-to-hex.java
public class Decimal2Hex {
private static String[] HEX = new String[]{
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"
};
public static String convert(final String numberText) {
final Object[] result = divideTo16(numberText);
final String quotient = (String) result[0];
View taginput.ts
import {AbstractControl} from '@angular/forms';
import {DbService} from '../service/db.service';
import {isArray} from 'util';
declare const $: any;
export class TagInput {
private _inputItem: any;
@firatkucuk
firatkucuk / BasHarflerBuyuk.txt
Created Aug 2, 2016
Yalnızca baş harfleri büyük yapmak için OpenOffice formülü
View BasHarflerBuyuk.txt
=BİRLEŞTİR(BÜYÜKHARF(PARÇAAL(D1;1;1));PARÇAAL(D1;2;UZUNLUK(D1)-1))
@firatkucuk
firatkucuk / tez.vim
Created Aug 2, 2016
Yüksek lisans tezi vim script dosyası
View tez.vim
if exists("b:current_syntax")
finish
endif
syntax region tezYapilacak start="\[YAPILACAK:" end="\]"
hi def link tezYapilacak Label
"highlight tezYapilacak ctermbg=magenta
@firatkucuk
firatkucuk / detect_malicious_code.sh
Created May 10, 2016
Malicious PHP code detection
View detect_malicious_code.sh
grep -r "base64_decode" --include=*.php [TARGET]
grep -r "eval" --include=*.php [TARGET]
grep -E -r "[a-zA-Z0-9+]{20,}" --include=*.php [TARGET]
View hourly-report.sql
WITH filtered_tag_log AS (
SELECT
data_value,
logtime,
logtime / (60 * 60 * 1000) log_hour
FROM
tag_log
WHERE
tag_id = 1
AND
@firatkucuk
firatkucuk / sinon_spy.js
Created Jan 4, 2015
sinon.js spy usage
View sinon_spy.js
'use strict';
var sinon = require('sinon');
var assert = require('assert');
var testObject = {
'testMethod': function () {
return 'testtest';
}
@firatkucuk
firatkucuk / sinon_stub.js
Last active Aug 29, 2015
sinon.js stub usage
View sinon_stub.js
'use strict';
var sinon = require('sinon');
var assert = require('assert');
var testObject = {
'testMethod': function () {
return 'testtest';
}