Skip to content

Instantly share code, notes, and snippets.

View olexpono's full-sized avatar

Olex Ponomarenko olexpono

View GitHub Profile
@olexpono
olexpono / wordpress_cleanup.rb
Last active December 21, 2015 01:09
Ruby Regex Examples / Scrubbing stuff out of Wordpress export files
require 'nokogiri'
print "WP XML filename: "
filename = gets.chomp
contents = File.open(filename).read
# This is purely for __client__001, probably not useful
# for a lot of exports
leadgen_regex = /\r?\n?\r?\n?<a[^>]*cr=LG.*\s*\r?\n?\s*\]\]/
leadgen_modules = contents.scan(leadgen_regex)
@olexpono
olexpono / .vimrc
Last active December 17, 2015 11:49
Dotfiles [9/27/13]
color molokai
if has("gui_running")
set guioptions=egmt
endif
set scrolloff=2
set listchars=trail:·,extends:>,tab:▻\ ,precedes:<
hi SpecialKey guifg=#313131
hi ExtraWhitespace ctermbg=black ctermfg=darkmagenta guifg=tan guibg=black
@olexpono
olexpono / stop_playing_R_n_B.rb
Created May 7, 2013 15:42
Inconspicuous Pusher-Powered Script
require 'logger'
require 'pusher-client'
logger = Logger.new(STDOUT)
options = {:secret => '~~~~~~~~~'}
socket = PusherClient::Socket.new('~~~~~~~~~~~', options)
# Subscribe to two channels
socket.subscribe('updates')
def getupdate
@olexpono
olexpono / html.md
Last active December 15, 2015 18:59
HTML

HTML is a format for organizing information. In a website, HTML is the first real code you get from a web server any time you visit. It is the conductor and skeleton of everything that goes and can go into a web page. While there's a wide range of browsers and an impetus to improve experiences on the web, they need a standard. Otherwise all the browsers would behave differently, leaving developers hopeless to support all the browsers, and users hitting roadblocks because they prefer one browser over another. HTML, specifically 5, is the answer to all these problems. It's an evolving standard developed collaboratively by web industry professionals.

HTML governs whether something is a link and where that link points to. A link in HTML looks like this:

@olexpono
olexpono / Custom.css
Last active February 14, 2023 15:44
Crate -- a Dark gray/orange Theme for Chrome DevTools
/**********************************************/
/*
/*
/* Crate -- Theme for Chrome DevTools
/* Last Update :: September 2013
/*
/* based on:
/* mnml by Michael P. Pfeiffer
/* Based on a Gist by Ben Truyman. Further attr:
/* https://gist.github.com/3040634
@olexpono
olexpono / basic_lfo.rb
Created August 15, 2012 03:55
little bitty LFO class for ruby-processing
# LFO for ruby-processing
# Calculates a triangle or sine function for a given frame.
# triangle wave min/rising/max/down ./`\ from [0..1]
# sine wave sine is 0/1/0/-1/0
# The current location of the wave can skip if you change
# the tempo on the fly, each LFO location is not simulated.
#
# Usage:
# create new lfo with a some tempo in frames:
# @lfo_engine = BasicLFO.new(100)
@olexpono
olexpono / history as of 2011
Created January 28, 2011 21:33
history | awk '{print $2}' | sort | uniq -c | sort -rn | head
2613 git
736 ls
638 cd
439 rails
403 rake
236 sudo
191 heroku
188 vim
132 cat
117 ssh
@olexpono
olexpono / xml2json.js
Created June 23, 2010 20:28
Getting nice JSON out of node-xml / object parse --hack
// Assumes that it is in /node-xml2object/lib
// if otherwise, change the require
var sys = require('sys'),
xml2object = require('./xml2object');
var xml = '<ListBucketResult><Name>bucket</Name><Prefix/><Marker/><MaxKeys>1000</MaxKeys><IsTruncated>false</IsTruncated><Contents><Key>my-image.jpg</Key><LastModified>2009-10-12T17:50:30.000Z</LastModified><ETag>&quot;fba9dede5f27731c9771645a39863328&quot;</ETag><Size>434234</Size><StorageClass>STANDARD</StorageClass><Owner><ID>8a6925ce4a7f21c32aa379004fef</ID><DisplayName>mtd@amazon.com</DisplayName></Owner></Contents><Contents><Key>my-third-image.jpg</Key><LastModified>2009-10-12T17:50:30.000Z</LastModified><ETag>&quot;1b2cf535f27731c974343645a3985328&quot;</ETag><Size>64994</Size><StorageClass>STANDARD</StorageClass><Owner><ID>8a69b1ddee97f21c32aa379004fef</ID><DisplayName>mtd@amazon.com</DisplayName></Owner></Contents></ListBucketResult>'
var indexes_to_array = function(o){
var arr = [];
for( index in o ){
arr = arr.concat(Array(o[index]));