Skip to content

Instantly share code, notes, and snippets.

View garex's full-sized avatar
🏒
❄️

Alexander Ustimenko garex

🏒
❄️
View GitHub Profile
@garex
garex / creadits to NESTOR URQUIZA
Created October 31, 2012 15:56
Mysql dump sort keys contraints
#!/usr/bin/gawk -f
#FUNCTIONS
function printRecords(array) {
if( array[0] != "" ) {
asort(array);
for( j = length(array); j >= 1 ; j-- ) {
lastChar = "";
if (j > 1) {
lastChar = ",";
}
@garex
garex / update-key-events-photos-by-rating.sh
Created February 9, 2014 13:20
Shotwell / Set event's key photos by max raiting (put it to ~/.shotwell/data/update-key-events-photos-by-rating.sh)
#!/usr/bin/env bash
function sql() {
local sql=$1
sqlite3 photo.db "$sql"
}
function go_to_current_directory() {
cd "$(dirname "$0")"
}
describe('transformToLessOperations', function() {
eval('var transformToLessOperations = require("..").transformToLessOperations');
var cm = require("color-model");
var cm = require("../../nodejs-color-model");
eval('var AbstractModel = cm.AbstractModel');
eval('var HexRgb = cm.HexRgb');
eval('var Hsl = cm.Hsl');
eval('var Rgb = cm.Rgb');
describe('extreme cases', function() {
@garex
garex / gist:9565057
Created March 15, 2014 10:49
Tryin to play with imitation of Color Scheme designer which is buggy from start to end :)
describe('transformToLessOperations', function() {
eval('var transformToLessOperations = require("..").transformToLessOperations');
var cm = require("color-model");
var cm = require("../../nodejs-color-model");
eval('var AbstractModel = cm.AbstractModel');
eval('var HexRgb = cm.HexRgb');
eval('var Hsl = cm.Hsl');
eval('var Rgb = cm.Rgb');
/*
@garex
garex / compile-n-run-hh.sh
Created March 4, 2015 10:19
Compile hh files and run without sources
#!/bin/bash
function log {
echo
echo "-- $1 --"
}
function run {
echo "# $1"
sh -c "$1"
#!/usr/bin/env bash
touch /tmp/powned

Slimdown

A very basic regex-based Markdown parser. Supports the following elements (and can be extended via Slimdown::add_rule()):

  • Headers
  • Links
  • Bold
  • Emphasis
  • Deletions
@garex
garex / prove.js
Last active August 29, 2015 14:26
innerHTML speed test code
var bodyHtml = document.body.innerHTML;
function a() {
var date = Date.now();
document.body.innerHTML = Math.random().toString() + 'test';
console.log('render ' + (Date.now() - date) + 'ms');
setTimeout(a, 0);
}
function b() {
var date = Date.now();
document.body.innerHTML = bodyHtml;
@garex
garex / Polyshit.java
Created November 20, 2015 09:47
What will be in the result?
package orthodox;
public class Polyshit {
public static void main(String[] args) {
Polyshit me = new Polyshit();
Number integerAsNumber = new Integer(1);
Integer integer = new Integer(1);
@garex
garex / git-log-commit-file.sh
Created December 23, 2015 13:59
Helps in interactive rebase
#!/usr/bin/env bash
START_COMMIT=${1:-develop}
END_COMMIT=${2:-HEAD}
range=$START_COMMIT..$END_COMMIT
echo 'Commits count: ' $(git log --oneline $range | wc -l)
GIT_PAGER=cat git log --reverse --no-merges --format='format:[%h] %s' --name-status $range