Skip to content

Instantly share code, notes, and snippets.

View yitsushi's full-sized avatar
🏳️‍⚧️

Victoria Nadasdi yitsushi

🏳️‍⚧️
View GitHub Profile
@yitsushi
yitsushi / gist:8ebc63ed2e36ea484b31
Created May 19, 2015 13:28
Coinbase API (EUR<->BTC) sell/buy value
package main
import (
"encoding/json"
"io/ioutil"
"log"
"net/http"
"strconv"
"strings"
)
From 0520fc27da8a63b4db7fbe4f732056004708cb0c Mon Sep 17 00:00:00 2001
From: Balazs Nadasdi <[email protected]>
Date: Tue, 17 Feb 2015 10:48:53 +0100
Subject: [PATCH] cross platform patch
---
__init__.py | 7 +++++--
loadik.py | 8 +++++---
main_brush.py | 10 +++++++---
3 files changed, 17 insertions(+), 8 deletions(-)
@yitsushi
yitsushi / OrderController.php
Created December 23, 2014 13:40
test from st3
use Origanum\Lib\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Component\HttpFoundation\Response;
<?php
if (array_key_exists('profileUrl', $_POST)) {
$url = $_POST['profileUrl'];
} else {
$url = "https://plus.google.com/u/0/+SergeyBrin/posts";
}
$url = preg_replace('/u\/\d+\//', '', $url);
$ch = curl_init();
#!/usr/bin/env node
function iNeedAnswers() {
var args = Array.prototype.slice.call(arguments),
answerCount = 0,
answers;
if (args.length < 1) { sampleRate = 1000; }
else if (parseInt(args[0], 10) != args[0]) { sampleRate = 1000; }
else { sampleRate = parseInt(args.shift(), 10); }
@yitsushi
yitsushi / index.php
Last active August 29, 2015 14:06
Front page for my nginx-static-and-php docker image (https://hub.docker.com/u/yitsushi/nginx-static-and-php/)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Experiments</title>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<h1>Experiments <small>list of available items</small></h1>
@yitsushi
yitsushi / generateInsertSQL.php
Last active August 29, 2015 14:06
ArrayMap example
<?php
function generateInsertSQL($table, $fields) {
$sql = "insert into `" . $table . "` ";
$sql .= "(" . implode(
", ",
array_map(
function($f) { return "`" . $f . "`"; },
array_keys($fields[0])
@yitsushi
yitsushi / xhr.php
Created September 8, 2014 10:06
xhr file process sample
<?php
if (isset($_GET['generate'])) {
file_put_contents("generatedReports/" . $_GET['generate'] . ".csv.pending", (string)date(time()));
echo json_encode(array('path' => "generatedReports/" . $_GET['generate'] . ".csv", 'filename' => $_GET['generate'] . ".csv"));
die();
}
if (isset($_GET['check'])) {
$files = array();
@yitsushi
yitsushi / base64_encode_decode.js
Created August 25, 2014 22:21
Only for ASCII text and does not contain validation. Inspired on Base64 Encoding Kata (thanks joseph.varnado to the kata)
var Int6 = (function() {
// Base64 ABC contains only A-Z, a-z, 0-9, + and /
// (and the = sign but it's just a marker)
var ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
return {
toChar: function(e) { return ABC.substr(e, 1); },
fromChar: function(e) { return ABC.indexOf(e); }
};
}());
@yitsushi
yitsushi / inheritance.php
Created August 25, 2014 13:52
Inheritance Example
<?php
define('DEBUG', true);
function debug($message) {
if (DEBUG) {
echo " -D- ", $message, "\n";
}
}