Skip to content

Instantly share code, notes, and snippets.

View TikiTDO's full-sized avatar

TikiTDO TikiTDO

  • Toronto, Canada
View GitHub Profile
@TikiTDO
TikiTDO / compiler.rb
Last active December 19, 2015 04:29
short example of abstract compilation performed on JS
Lex Config for C - http://www.quut.com/c/ANSI-C-grammar-l.html
Bison Config for C - http://www.quut.com/c/ANSI-C-grammar-y.html
ECMA Spec - http://www.ecma-international.org/ecma-262/5.1/#contents
# Organization
# Statements (Executes an operation)
# Expressions (Evaluates to a value)
js = <<js
function hello() {

System Management

These services are used to control network resources

Security

IAM - Manages multiple users across one AWS account

Enterprise Services

Direct Connect – Connects AWS to Data Centers

Storage Gateway - Provides direct access to storage systems

=begin
# Staging Module
Allows for the configuration of execution stages, and provides code to be executed in
that stage. Node, code is executed in the current context.
This is particularly useful for tasks that need to be performed at specific spots in
the loading process. May also be useful for cleanup code.
## Usage
binding.stage :name do
require 'httpclient'
cln = HTTPClient.new
cln.get_content('http://ipv4.download.thinkbroadband.com/5MB.zip') do |s|
puts 1
end
@TikiTDO
TikiTDO / dust_slim.rb
Last active December 22, 2015 23:48
Dust + Slim multi builder Watches a directory in a sleep loop, and executes build chains based on file extensions. Currently supports dust and slim
#!/usr/bin/env ruby
require 'rubygems'
require 'slim'
require 'slim/command'
require 'pry'
def dust(tag, tag_end = nil)
ret = "{##{tag}}"
ret += yield
state = :init
n = 0
STDIN.each_line do |line|
n += 1
if state == :init
if line =~ /Creating default object from empty value/
state = :stack
next
end
elsif state == :stack
require 'pry'
File.open("out") do |file|
cur_file = nil
diff_files = []
only_files = []
bleh = []
file.each_line do |line|
wtf = nil
begin
@TikiTDO
TikiTDO / action profile.php
Last active August 29, 2015 13:56
WordPress do_actions profile
<?php
do {
_logt("Start Action Tag: $tag");
_logup();
$t_count = 1;
foreach ( (array) current($wp_filter[$tag]) as $the_ ) {
//$func = $the_['function'];
//if (is_string($func)) _log(" " . $func);
//else _log(' *** ' . get_class($func[0]) . ' ' . $func[1]);
}
@TikiTDO
TikiTDO / filter profile.php
Last active August 29, 2015 13:57
WordPress apply_filter profile
<?php
do {
_logt("Start Filter Tag: $tag");
_logup();
$t_count = 1;
foreach ( (array) current($wp_filter[$tag]) as $the_ ) {
//$func = $the_['function'];
//if (is_string($func)) _log(" " . $func);
//else _log(' *** ' . get_class($func[0]) . ' ' . $func[1]);
}
@TikiTDO
TikiTDO / css_search.coffee
Last active August 29, 2015 13:57
CSS Property Search
# Filter DOM elements that match all the given CSS rules
# Search Spec: {
# 'css_rule': value,
# OR
# 'css_rule': boolean_callback
# Example:
# $('div').find_by_css({body: 'white'}) # => All divs with css style body == 'white'
#
# var is_even = function (value) {value % 2 == 0}}
# $('div').find_by_css({'font-size': is_even) # => All divs with an event font size