Skip to content

Instantly share code, notes, and snippets.

View index.html
<!DOCTYPE html>
<html>
<head>
<script src="https://npmcdn.com/expect/umd/expect.min.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
@johnrees
johnrees / opacity_mixin.css.scss
Created May 2, 2012
SASS/SCSS Internet Explorer Compatible Opacity Mixin
View opacity_mixin.css.scss
@mixin opacity($alpha) {
// IE 8
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=$alpha*100)";
// IE 5-7
filter: alpha(opacity=$alpha*100);
// Real Browsers
-webkit-opacity: $alpha;
-moz-opacity: $alpha;
-khtml-opacity: $alpha;
opacity: $alpha;
@bahmutov
bahmutov / tmux.md
Last active Mar 31, 2017
tmux basics
View tmux.md

install

Install on Mac using brew install tmux and start with tmux

main commands

See help (list of commands) with Control-b ? key combination. Leave help view by pressing q key. From now on use Control-b (aka C-b) to start all tmux commands (C-b is called command prefix and can be changed, see tmux.config options).

@getify
getify / 1.js
Last active Oct 15, 2017
generators as object iterator
View 1.js
// ugly way
var obj = {
a: 1,
b: 2,
c: 3,
[Symbol.iterator]() {
var keys = Object.keys(this);
var idx = 0;
return {
View gist:67c719b8597a837d59fd
import java.util.Map;
import java.util.Comparator;
import java.util.Collections;
int index = 0;
PImage pokemon, current;
PGraphics pie;
HashMap<Integer,Integer> colorMap;
ArrayList<Integer> colorByCount;
View gist:a078a580974c2d917e5d
<?xml version="1.0"?>
<root>
<item>
<name>Control/Escape</name>
<appdef>
<appname>MACVIM</appname>
<equal>org.vim.MacVim</equal>
</appdef>
<appdef>
<appname>TERMINAL</appname>
@PatrickJS
PatrickJS / factory-shared.es5.js
Last active Apr 19, 2018
Different examples of OOP "class" with "inheritance" done using JavaScript including languages that transpile into js. Take notice to the amount of boilerplate that's needed in ES5 compared to ES6. These examples all have the same interface with pros/cons for each pattern. If they seem similar that's whole point especially the difference between…
View factory-shared.es5.js
var EventEmitter = require('events').EventEmitter;
var _ = require('lodash');
// Factory shared
var makePerson = function() {
var person = {};
EventEmitter.call(person);
person.wallet = 0;
_.extend(person, personMethods)
return person;
@linjunpop
linjunpop / deploy-rails-4-app-with-dokku-on-digital-ocean.md
Last active May 9, 2018
Deploy Rails 4 app with Dokku on DigitalOcean
View deploy-rails-4-app-with-dokku-on-digital-ocean.md

Deploy Rails 4 app with Dokku on DigitalOcean

Install dokku

First create a Ubuntu 13.04 x64 droplet on DigitalOcean Control Panel

Then ssh with root account, run this in termianl:

$ wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
View bashrc.sh
// by @noffle
autoinstall () {
local MODULES=$(cat $1 | grep "require('.*')" | sed "s/.*require('\(.*\)')/\1/" | grep -v '^\.' | tr '\n' ' ')
shift
shift
npm install $MODULES $@
}
@johnrees
johnrees / _ubuntu_steps.sh
Last active May 29, 2018
Standard Rails 5.* setup for Ubuntu 14.04 LTS
View _ubuntu_steps.sh
# As root user
sudo su
# Update the OS
sudo apt-get update -y
# Add this to ~/.bashrc to remove timezone warnings
echo 'export LC_ALL="en_US.UTF-8"' >> ~/.bashrc
source ~/.bashrc