Skip to content

Instantly share code, notes, and snippets.

View Restuta's full-sized avatar
🦄
Hacking fast and slow.

Anton Vynogradenko Restuta

🦄
Hacking fast and slow.
View GitHub Profile
@Restuta
Restuta / gist:5267805
Created March 28, 2013 23:59
powershell wtf
$lastCommitMessage = (git log --pretty=format:'%B' HEAD^..HEAD)
if ($lastCommitMessage | Where-Object {$_ -Match "@(?<changesetId>\d+)"} ) {
Write-Host $matches["changesetId"] -ForegroundColor Red
}
if ($lastCommitMessage -Match "@(?<changesetId>\d+)") {
Write-Host $matches["changesetId"] -ForegroundColor Red
}
@Restuta
Restuta / gist:5448222
Created April 23, 2013 23:13
Cyclone Record data structure
{
"Record" : {
"HR": 147,
"Speed": 23.3, //km/h? m/h?
"Cadence": 81,
"Temperature": 23,
"GpsData": {
"Latitude": -23423423423,
"Longitude": 23423423323
}
@Restuta
Restuta / index.html
Last active December 17, 2015 08:19
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"/>
<script src="http://cmx.io/v/0.1/cmx.js"></script>
<body>
<scene id="scene1">
<label t="translate(0,346)">
<tspan x="0" y="0em">One happy day</tspan>
</label>
<actor t="translate(40,50)" pose="-11,9|0,137|-11,99|-11,89|-11,79|-11,59|-16,34|-21,9|-6,34|-1,9|-18,76|-22,64|-6,79|-2,61">
private const string ErrorPrifix = "Error, ";
public const string DescriptionException = "Unexpected error occured.";
public const string DescriptionArgumentNullException = ErrorPrifix + "Attemp to access a null reference.";
public const string DescriptionArgumentOutOfRangeException = ErrorPrifix + "the value of an argument is outside the allowable range of values as defined by the invoked method.";
public const string DescriptionFileNotFoundException = ErrorPrifix + "Failed to find file.";
public const string DescriptionRankException = ErrorPrifix + "Error, An array with the wrong number of dimensions is passed to a method.";
public const string DescriptionInvalidCastException = ErrorPrifix + "invalid casting or explicit conversion.";
public const string DescriptionFormatException = ErrorPrifix + "the format of an argument does not meet the parameter specifications of the invoked method.";
public const string Descripti
@Restuta
Restuta / gist:6083090
Created July 25, 2013 19:45
R# custom exception file template
using System;
using System.Runtime.Serialization;
using SaaS.Exceptions;
namespace $NAMESPACE$
{
/// <summary>
/// Thrown when $Reason$.
/// </summary>
[Serializable]
class Player
def play_turn(warrior)
if warrior.health < @health && warrior.health < 12
warrior.walk!(:backward)
else
if warrior.health < 20 && warrior.health >= @health
warrior.rest!
else
if warrior.feel.wall?
@Restuta
Restuta / gist:7000007
Created October 15, 2013 23:05
Sencha 'Single tap' example
Ext.Loader.setConfig({
enabled : true
});
Ext.application({
name : ('SF' || 'SenchaFiddle'),
launch : function() {
Ext.create('Ext.List', {
fullscreen: true,
@Restuta
Restuta / gist:7011923
Created October 16, 2013 17:48
count of unique emails from several tables
SELECT DISTINCT COUNT(*)
FROM (
SELECT email FROM active_developers_april2013
UNION
SELECT email FROM active_developers_february2013
UNION
SELECT email FROM active_developers_march2013
) as united_developers
@Restuta
Restuta / gist:7224644
Last active December 26, 2015 22:39
charts for flexicharts from http://www.cyclinganalytics.com/
rides
.avg_power()
.filter(function(ride) {
return !ride.has.gps;
})
.line({color: 'hsl(270, 70%, 70%)', name: 'Average PWR'})
rides
.avg_heartrate()
@Restuta
Restuta / index.html
Created November 4, 2013 18:14 — forked from Tanaha/index.html
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css">
<script src="http://cmx.io/v/0.1/cmx.js" charset="utf-8"></script>
<style>.cmx-user-scene4 .cmx-text-border .cmx-path {stroke: orange}</style>
<body>
<div style="max-width:900px; -webkit-transform:rotate(0deg)">
<scene id="scene1">
<label t="translate(0,346)">