Skip to content

Instantly share code, notes, and snippets.

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

Victoria Nadasdi yitsushi

🏳️‍⚧️
View GitHub Profile
@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>
#!/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); }
<?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();
@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;
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 / 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"
)
@yitsushi
yitsushi / Makefile
Last active April 15, 2016 11:44
Epic Makefile for Go. (make help for more info)
all: cover build
coverFile := $(shell mktemp -u -t cover.out.XXXXXX)
projectName := $(shell basename `pwd`)
hasGocov := #$(shell which gocov)
packages := $(shell go list ./...)
ifndef OUTPUT
OUTPUT = "text"
endif
#!/usr/bin/env node
var sys = require("sys"),
spawn = require('child_process').spawn;
/*
* htmlEntities function is from Chris Coyier
* URL: http://css-tricks.com/snippets/javascript/htmlentities-for-javascript/
*/
function htmlEntities(str) {
// ... cut
Users.findById(id, function(err, result) {
if (err) {
// OMG! We got an error
return response.redirect('/404.html');
}
// nice we can do something with user
});
// ... cut
@yitsushi
yitsushi / wordpress.js
Last active August 29, 2015 14:24
Wordpress archive widget to annually grouped list
jQuery(function() {
var archive = jQuery('.widget_archive li a').toArray().map(function(item) {
var t = item.innerText.split(/ /);
return {
'link': item.getAttribute('href'),
'year': parseInt(t[1], 10),
'month': t[0],
'count': parseInt(item.parentNode.innerText.match(/\(([0-9]+)\)$/)[1], 10)
};
}).reduce(function(memo, item) {