Skip to content

Instantly share code, notes, and snippets.

.repl_history
build
tags
.DS_Store
*.swp
*.swo
resources/*.nib
resources/*.momd
resources/*.storyboardc
.DS_Store
// I pasted this without even looking at it. It the code running in the video here: http://youtu.be/OZ_9Yg0PG3M
// The video is of an Arduino controlling a single 8x8 LED matrix via an MBI5026 chip + a single 74HC595 shift register.
// Link to the MBI5026: http://www.rayslogic.com/propeller/programming/AdafruitRGB/MBI5026.pdf
#define SDI 10
#define CLK 9
#define LE 8
#define LED 17
// 74HC595
#define SHSDI 3 // DS (pin 14 on shift register)
require 'benchmark'
N = 10_000_000
Benchmark.bmbm do |bm|
bm.report('String') do
N.times do
a = 'devise/session'
a.sub('/', '-')
end
@sashaegorov
sashaegorov / cs-jq-plugin-template.coffee
Created October 30, 2015 10:02 — forked from rjz/cs-jq-plugin-template.coffee
Coffeescript jQuery Plugin Class Template
# A class-based template for jQuery plugins in Coffeescript
#
# $('.target').myPlugin({ paramA: 'not-foo' });
# $('.target').myPlugin('myMethod', 'Hello, world');
#
# Check out Alan Hogan's original jQuery plugin template:
# https://github.com/alanhogan/Coffeescript-jQuery-Plugin-Template
#
(($, window) ->
@sashaegorov
sashaegorov / node-cluster-messaging.js
Created May 14, 2016 14:11 — forked from jpoehls/node-cluster-messaging.js
Simple message passing between cluster master and workers in Node.js
var cluster = require('cluster');
if (cluster.isWorker) {
console.log('Worker ' + process.pid + ' has started.');
// Send message to master process.
process.send({msgFromWorker: 'This is from worker ' + process.pid + '.'})
// Receive messages from the master process.
@sashaegorov
sashaegorov / .eslintrc
Created September 18, 2016 16:42 — forked from elycruz/.eslintrc
.eslintrc as yaml file
# --------------------------------------------------------------------------------------------------------------------- #
# Conversion of http://eslint.org/docs/rules/ to an actual .eslintrc file:
# Copied: 04/01/2015
# Updated to yaml format: 05/15/2015
# Copied by: Ely De La Cruz <[email protected]>
# --------------------------------------------------------------------------------------------------------------------- #
# --------------------------------------------------------------------------------------------------------------------- #
# Environemnt Types:
# --------------------------------------------------------------------------------------------------------------------- #
@sashaegorov
sashaegorov / ar_arel_wrapper.rb
Created February 22, 2017 10:34 — forked from tokland/ar_arel_wrapper.rb
Simple wrapper over arel
require 'active_record'
require 'arel'
# Ruby-like syntax in AR conditions using the underlying Arel layer (Rails >= 3.0).
#
# What you would usually write like this:
#
# User.where(["users.created_at > ? AND users.name LIKE ?", Date.yesterday, "Mary"])
#
# can now be written like this (note those parentheses required by the operators precedences):
@sashaegorov
sashaegorov / multipleinheritance.py
Created April 27, 2023 19:32 — forked from litzomatic/multipleinheritance.py
Understanding super and multiple inheritance in Python.
class Bar(object):
def __init__(self, bar='bar', *args, **kwargs):
self.bar = bar
super(Bar, self).__init__(*args, **kwargs)
class Foo(object):
def __init__(self, foo='foo', *args, **kwargs):
self.foo = foo
super(Foo, self).__init__(*args, **kwargs)
blueprint:
name: Moes Smart Knob for lights (_TZ3000_qja6nq5z)
description: 'Control lights with a Moes Smart Knob.
You can set functions for a single press. This allows you to assign,
e.g., a scene or anything else.
Rotating left/right will change the brightness smoothly of the selected light.
Not all functionality of the device is available at time of writing, e.g. double press, long press and press and rotate.'