Skip to content

Instantly share code, notes, and snippets.

@niuage
niuage / vim-heroku.sh
Created May 19, 2022 20:04 — forked from dvdbng/vim-heroku.sh
Run vim in heroku updated 2017
mkdir ~/vim
cd ~/vim
# Staically linked vim version compiled from https://github.com/ericpruitt/static-vim
# Compiled on Jul 20 2017
curl 'https://s3.amazonaws.com/bengoa/vim-static.tar.gz' | tar -xz
export VIMRUNTIME="$HOME/vim/runtime"
export PATH="$HOME/vim:$PATH"
cd -
@niuage
niuage / CausticsFeature.cs
Created May 3, 2022 11:38
Caustics feature for setting the light direction
using UnityEngine;
using UnityEngine.Rendering.Universal;
public class CausticsFeature : ScriptableRendererFeature
{
[System.Serializable]
public class CausticsSettings
{
public RenderPassEvent renderPassEvent = RenderPassEvent.AfterRenderingTransparents;
public Material causticsMaterial;
}
@niuage
niuage / CausticsPass.cs
Created May 3, 2022 11:38
Caustics pass for setting the light direction
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
public class CausticsPass : ScriptableRenderPass
{
private CausticsFeature.CausticsSettings settings;
public CausticsPass(CausticsFeature.CausticsSettings settings)
{
@niuage
niuage / Caustics.shader
Created May 3, 2022 11:38
Caustics shader
Shader "Caustics"
{
Properties
{
[Header(Caustics)]
_CausticsTexture("Texture", 2D) = "white" {}
_CausticsStrength("Strength", float) = 0
_CausticsSplit("RGB Split", float) = 0
[Header(Movement)]
@niuage
niuage / on-jsx.markdown
Created June 15, 2016 15:29 — forked from chantastic/on-jsx.markdown
JSX, a year in

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I lead the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can'

@niuage
niuage / digital_ocean_setup.md
Created November 8, 2015 22:27 — forked from ChuckJHardy/digital_ocean_setup.md
DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3 Setup Instructions

DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3

SSH into Root

$ ssh root@123.123.123.123

Change Root Password

@niuage
niuage / introrx.md
Created August 26, 2014 17:33 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

require 'rubygems'
require 'tire'
Tire.configure { logger 'elasticsearch.log', :level => 'debug' }
class Document
attr_accessor :title, :content
include Tire::Model::Persistence
include Tire::Model::Search
include Tire::Model::Callbacks
@niuage
niuage / es.sh
Created March 16, 2013 02:14 — forked from samnang/es.sh
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
curl -k -L -o elasticsearch.tar.gz http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.5.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
sudo mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
# Run with: rake environment elasticsearch:reindex
# Begins by creating the index using tire:import command. This will create the "official" index name, e.g. "person" each time.
# Then we rename it to, e.g. "person20121001" and alias "person" to it.
namespace :elasticsearch do
desc "re-index elasticsearch"
task :reindex => :environment do
klasses = [Place, Person, Caption]