Skip to content

Instantly share code, notes, and snippets.

@sruli
sruli / gist:4541699
Last active December 11, 2015 03:58
addLoadEvent(function() {
var dropdowns = form.getElementsByTagName("select");
setInterval(function() {
for(var i = 0; i < dropdowns.length; ++i) {
if(dropdowns[i].value != "") {
if(document.getElementsByClassName(dropdowns[i].id).length == 0) {
var input = document.createElement("input");
input.type = "hidden";
input.className = dropdowns[i].id;
input.name = "lists[]";
@sruli
sruli / gist:4545272
Last active December 11, 2015 04:28
addLoadEvent(function() {
var dropdowns = form.getElementsByTagName("select");
for(var i = 0; i < dropdowns.length; ++i) {
dropdowns[i].onchange = function() {
if(dropdowns[i].value != "") {
if(document.getElementsByClassName(dropdowns[i].id).length == 0) {
var input = document.createElement("input");
input.type = "hidden";
input.className = dropdowns[i].id;
input.name = "lists[]";
@sruli
sruli / gist:4562894
Last active December 11, 2015 06:58
array = ["a", "b"]
index = 0
array.map do |letter|
next if letter == "a"
index += 1
end
<div class="mimi_webform_container">
<div class="mimi_webform<%= @signup.logo_background_color == 'transparent' ? '' : ' with_bg' %>">
<% if @signup.has_logo? %>
<div class="mimi_webform_header mimi_webform_logo <%= @signup.logo_ui_dark? ? 'ui_dark' : 'ui_light' %>" style='background-color:<%= @signup.logo_background_color %>; width:<%= @signup.iframe_form_width %>px;'>
<h1 style="color: <%= @signup.font_color %>;"><%= @signup.iframe_header %></h1>
</div>
<% end %>
<%= @signup.form_text(false, true) %>
</div>
</div>
@sruli
sruli / gist:4730828
Last active December 12, 2015 06:39
12 dorchester
high level road
074 656 1883 dovi
074 240 7275 daniel
seapoint
wendy 021 434 8680
cell 082 765 7801
beit midrash morasha
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
#include <FastLED.h>
#define NUM_LEDS 10
#define LED_PIN 9
#define LED_TYPE WS2811
CRGB led[NUM_LEDS];
void setup()
//Program by Michael Bartlett
//Libraries
#include <Adafruit_NeoPixel.h> //Library to simplify interacting with the LED strand
#ifdef __AVR__
#include <avr/power.h> //Includes the library for power reduction registers if your chip supports them.
#endif //More info: http://www.nongnu.org/avr-libc/user-manual/group__avr__power.htlm
//Constants (change these as necessary)
#define LED_PIN A5 //Pin for the pixel strand. Does not have to be analog.
import { EditorState, ContentState, convertFromRaw } from 'draft-js';
const editorStateReducer = (state = defaultEditorState, action) => {
switch(action.type) {
case MORE_CONTENT_RETRIEVED: {
// Capture current state
const currentContentState = state.getCurrentContent();
const currentBlockMap = currentContentState.getBlockMap();
const currentSelection = state.getSelection();
const currentContentState = state.getCurrentContent();
const currentBlockMap = currentContentState.getBlockMap();
const currentSelection = state.getSelection();