Skip to content

Instantly share code, notes, and snippets.

@jzelenkov
jzelenkov / react-helloworld.html
Last active September 30, 2015 06:37
React + Babel straight outta browser
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello React!</title>
<script src="build/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script>
</head>
<body>
<div id="example"></div>
Array.prototype.shuffle = function() {
var tmp = this.slice(0);
var res = [];
var pos;
for (var i = 0; i < this.length; i++) {
pos = Math.floor(Math.random() * tmp.length);
res.push(tmp.splice(pos, 1));
}
return "[" + res.join(", ") + "]";
}
@jzelenkov
jzelenkov / minifier.js
Created February 9, 2015 13:59
updated minified.js for `minifyify` which mangles the whole output bundle js instead of each file individually
/*
* Consumes the output stream from Browserify
*/
Minifier.prototype.consumer = function (cb) {
var self = this;
return concat(function(data) {
if(!self.opts.minify) {
// Keep browserify's sourcemap
return cb(null, data.toString(), null);
// /////////////////////////////////////////////
// // hover pointer to the middle of the element
// /////////////////////////////////////////////
// moveMouseTo : function moveMouseTo(selector) {
// var element = document.querySelector(selector);
// var evt = element.ownerDocument.createEvent('MouseEvents');
// // clientX value: 516
require 'test_helper'
class IntroductionTest < ActionDispatch::IntegrationTest
test "guided user introduction" do
visit app_path
find('#get_started_link').must_be :visible?
click_link 'Get started now! Sign up!'
find('#get_started').must_be :visible?

Keybase proof

I hereby claim:

  • I am jzelenkov on github.
  • I am jzelenkov (https://keybase.io/jzelenkov) on keybase.
  • I have a public key whose fingerprint is 9C51 86D8 EE56 5C76 791C 47F1 00B9 8778 1B0E 1398

To claim this, I am signing this object:

@jzelenkov
jzelenkov / TestFCA.java
Created September 24, 2014 20:29
Test cases for the most common ancestor problem
package findcommonancestor;
import org.junit.Test;
import static org.junit.Assert.*;
public class TestFCA {
FindCommonAncestor fca = new MyFindCommonAncestor();
String result, commit1, commit2;
#!/bin/bash -ex
# Paste this into ssh
# curl -sL https://gist.github.com/andsens/2913223/raw/bootstrap_homeshick.sh | tar -xzO | /bin/bash -ex
# When forking, you can get the URL from the raw (<>) button.
### Set some command variables depending on whether we are root or not ###
# This assumes you use a debian derivate, replace with yum, pacman etc.
aptget='sudo apt-get'
chsh='sudo chsh'
@jzelenkov
jzelenkov / SassMeister-input.scss
Created July 23, 2014 18:49
Generated by SassMeister.com.
// ----
// Sass (v3.3.10)
// Compass (v1.0.0.alpha.20)
// ----
$types: text, color, date, datetime, datetime-local, email, month, number, range, search, tel, time, url, week;
$joined-selector: null;
@each $prop in $types {
$elem: "input[type='#{$prop}']";
@jzelenkov
jzelenkov / SassMeister-input.scss
Created July 23, 2014 18:28
Generated by SassMeister.com.
// ----
// Sass (v3.3.10)
// Compass (v1.0.0.alpha.20)
// ----
$types: text, color, date, datetime, datetime-local, email, month, number, range, search, tel, time, url, week;
@each $prop in $types {
input[type="#{$prop}"] {
padding: 0;