Skip to content

Instantly share code, notes, and snippets.

View redexp's full-sized avatar

Sergii Kliuchnyk redexp

View GitHub Profile
@redexp
redexp / build-clear.js
Created February 16, 2023 21:19
Build cleared elk-worker from no needed code
const recast = require('recast');
const b = recast.types.builders;
const esprima = require('esprima-next');
const {readFileSync, writeFileSync} = require('fs');
const {resolve} = require('path');
const used = require('./used.json');
const INPUT = resolve(__dirname, 'node_modules/elkjs/lib/elk-worker.js');
const OUTPUT = resolve(__dirname, 'elk-worker-clear.js');
@redexp
redexp / Pseudo-code2flow.sublime-syntax
Last active October 6, 2020 17:53
Pseudo code2flow syntax highlight for sublime
%YAML 1.2
---
name: Pseudo code2flow
file_extensions: [pc2f]
scope: source.pc
contexts:
main:
@redexp
redexp / customers_partitions.sql
Created March 28, 2015 05:28
Postgres auto partition function
-- customers table
-- id: INT
-- poll_id: INT # Foreign key for table poll
-- ... other columns
CREATE SCHEMA customers_partitions;
CREATE OR REPLACE FUNCTION insert_customers()
RETURNS TRIGGER AS $$
DECLARE
@redexp
redexp / backbone-example.js
Created December 18, 2014 13:32
Example of backbone usage
jQuery(function($) {
var Friend = Backbone.Model.extend({
defaults: {
name: ''
}
});
var FriendsList = Backbone.Collection.extend({
model: Friend
@redexp
redexp / gulp-js-to-tss.js
Created October 14, 2014 12:59
Write styles for titanium alloy like normal node js module and this code will convert it to tss. Expects js files will be in `styles-scr` folder.
var gulp = require('gulp'),
watch = require('gulp-watch'),
plumb = require('gulp-plumber'),
replace = require('gulp-replace'),
rename = require('gulp-rename');
gulp.task('tss', function () {
watch('app/styles-src/*.js')
.pipe(plumb())
.pipe(replace(/.*?\{/m, ''))
@redexp
redexp / backbone-bacon-view.js
Last active August 29, 2015 13:56
prototype for backbone bacon view class
view.when('@done').$el().toggleClass('done')
view.when('#edit').$el().toggleClass('editing')
view.find(':checkbox').connect('checked', 'done')
title = view.find('.edit')
title.connect('value', 'title', {on: 'keyup'})
RxView.merge(
title.on('keydown').filterKey('Enter').preventDefault(),
title.on('blur')