Skip to content

Instantly share code, notes, and snippets.

@elektronaut
elektronaut / bigrams.txt
Created November 19, 2022 04:00
Symbols frequency
Bigrams
=======
<% 36660
%> 36660
", 32607
-- 28212
</ 27362
## 23585
=" 20999
== 20323
// General rich textarea
function jRichTextArea(textArea, options) {
this.textArea = textArea;
// Default options
settings = jQuery.extend({
className: "richTextToolbar"
}, options);
this.toolbar = {
.spoiler, .spoiler *, .spoiler:after {
-webkit-transition: all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
-ms-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
}
.spoiler {
border: 1px solid transparent;
class MyModel < ActiveRecord::Base
def foo=(foo)
if foo == "thing"
self.bar = "a thing was found"
end
end
end
class List
def initialize
@list = Hash.new(0)
end
def add_item(item)
@list[item] += 1
end
end
@elektronaut
elektronaut / gist:4717588
Last active December 12, 2015 04:49
Processing save frames
boolean output = true;
int frameNumber = 0;
void setup() {
smooth();
size(1280, 720, P3D);
fill(0);
}
void draw() {
default_run_options[:pty] = true
# Name of application
set :application, "yourapp"
# Your username on the server
set :user, "app"
set :runner, user
# Use sudo?
@elektronaut
elektronaut / gist:3483910
Created August 26, 2012 22:21
adaptive.scss
$font-size: 16;
$line-height: $font-size * 1.5;
$column-width: 60;
$gutter-width: 16;
$rem: $font-size / 1rem;
@mixin font-size($size: $font-size) {
font-size: $size + px;
font-size: $size / $rem;
}
# Model
class Foo < ActiveRecord::Base
class << self
def fetch_bar(bar)
self.create({
:bar => open("http://bar.com/#{bar}").read
})
end
end
end
class Numeric
def percent
self.to_f / 100.0
end
end
class Float
def chance?
rand < self
end