Skip to content

Instantly share code, notes, and snippets.

<?php
// As they have come, so they will go.
// - Kemal Ataturk, Istanbul, 13 Nov 1918
$app->get('/occupy-bosphorus', function() use ($ataturk) {
$ataturk->redirect($_SERVER["HTTP_REFERER"]);
});
?>
@frknbasaran
frknbasaran / date modifier
Created November 3, 2015 09:11
convert from 2015-11-02 13:20:56.387Z to 02/11/2015 13:20:56
module.exports = function (date) {
var year = date.substr(0,4);
var month= date.substr(5,2);
var day = date.substr(8,2);
var h = date.substr(11,2);
var m = date.substr(14,2);
var s = date.substr(17,2);
return day + "/" + month + "/" + year + " " + h + ":" + m + ":" + s;
}
$(function() {
function init5() {
$('#bes').draggable({
cursor: 'move',
containment: 'document',
stop: handleDragStop
});
}
function handleDragStop(event, ui) {
header("Content-type: text/xml; charset=utf-8");
if($_POST) {
$x = $_POST['x'];
$y = $_POST['y'];
$response = '<?xml version="1.0" encoding="utf-8"?>';
$response .= '<response><x>'.$x.'</x>';
$response .= '<y>'.$y.'</y></response>';
echo $response;
@frknbasaran
frknbasaran / api.js
Created September 18, 2017 00:26
plugin/api/api.js
var plugin = {},
common = require('../../../api/utils/common.js'),
countlyCommon = require('../../../api/lib/countly.common.js'),
plugins = require('../../pluginManager.js');
(function (plugin) {
function getPeriodObj(params) {
params.qstring.period = params.qstring.period || "month";
if (params.qstring.period && params.qstring.period.indexOf(",") !== -1) {
@frknbasaran
frknbasaran / prog.cpp
Last active September 28, 2017 18:57
Read some text from txt and write it into another one w/ c++.
/*
Import dependencies
*/
// input output stream library
#include <iostream>
// string library for get line as a string from file
#include <string>
// included for streaming validate function
#include <sstream>
var MongoClient = require('mongodb').MongoClient;
// Connection URL
var url = 'mongodb://localhost:27017/myproject';
// Use connect method to connect to the Server
MongoClient.connect(url, function(err, db) {
console.log("Connected correctly to server");
db.createCollection("gevsek");
/* React */
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Image,
Dimensions,
TextInput,
apply plugin: "com.android.application"
import com.android.build.OutputFile
/**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
* and bundleReleaseJsAndAssets).
* These basically call `react-native bundle` with the correct arguments during the Android build
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
@frknbasaran
frknbasaran / CountlyGAWrapper.html
Last active October 5, 2018 14:43
Send your data to Countly with GA methods.
<!DOCTYPE html>
<html>
<body>
<!-- Countly Web SDK Initialization -->
<script type="text/javascript">
// Some default pre init
var Countly = {};
Countly.q = Countly.q || [];
// Provide your app key that you retrieved from Countly dashboard