Skip to content

Instantly share code, notes, and snippets.

@tekin
tekin / .gitattributes
Last active July 9, 2024 20:31
An example .gitattributes file that will configure custom hunk header patterns for some common languages and file formats. See https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more for more details.
# Stick this in your home directory and point your Global Git config at it by running:
#
# $ git config --global core.attributesfile ~/.gitattributes
#
# See https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more for more details
*.c diff=cpp
*.h diff=cpp
*.c++ diff=cpp
*.h++ diff=cpp
@aronallen
aronallen / spoke.ts
Last active July 27, 2018 12:54
cycle-spoke
/*
Below is a simplified state management library for Cycle JS.
It is named after a spoke on a bicycle wheel, because a spoke at the bottom of the wheel will be at the top after a semi-revoltion.
cycle-spoke aims to be approachable, fun, fractal, and easy to use for developers who are familiar with reducers.
Any cycle component can be spoked, spoke creates a local circular reference, and you can have as many spoked components as you like.
It applies any reducers emitted from the components spoke sink to the internal state, and provides a source of the derived state.
A spoked component has no initial state, so you must emit a reducer that sets the initial state on load.
A spoked component may receive reducers from its parent. A spoked component returns it's state as a sink.
@KdotJPG
KdotJPG / OpenSimplex2S.java
Last active October 13, 2024 16:49
Visually isotropic coherent noise algorithm based on alternate constructions of the A* lattice.
/**
* K.jpg's OpenSimplex 2, smooth variant ("SuperSimplex")
*
* More language ports, as well as legacy 2014 OpenSimplex, can be found here:
* https://github.com/KdotJPG/OpenSimplex2
*/
public class OpenSimplex2S {
private static final long PRIME_X = 0x5205402B9270C86FL;
@staltz
staltz / introrx.md
Last active November 17, 2024 01:08
The introduction to Reactive Programming you've been missing
@Martin1982
Martin1982 / provision.sh
Last active August 29, 2015 14:00
Shell Provisioner for Vagrant with Ansible on Windows Hosts
#!/usr/bin/env bash
# Assumes apt is available and has a source with the Ansible package
sudo apt-get update
sudo apt-get install ansible -y
# hosts file with only the text '127.0.0.1', change path accordingly
# required because Windows makes files executable by default which Ansible doesn't like
sudo cp /vagrant/provisioning/hosts /tmp
chmod 666 /tmp/hosts
@JeffreyWay
JeffreyWay / tip.sh
Created August 15, 2013 17:51
Ever want to undo everything that you've worked on since the last commit (including adding new files)? Here's a little alias to help with that.
alias gundo='git reset HEAD~ && git clean -df'
@lyrixx
lyrixx / post-checkout
Created June 26, 2013 13:37
Git post checkout
#!/bin/bash
# Put this file at: .git/hooks/post-checkout
# and make it executable
# You can install it system wide too, see http://stackoverflow.com/a/2293578/685587
PREV_COMMIT=$1
POST_COMMIT=$2
NOCOLOR='\e[0m'
<?php
error_reporting(E_ALL);
class StringTypeHandler {
public function length() {
return strlen($this);
}
}
@asakurayoh
asakurayoh / Builder.php
Created November 17, 2012 22:38
Single Table Inheritance in Laravel 4 / Illuminate
<?php namespace App;
use Illuminate\Database\Eloquent\Builder as BaseBuilder;
class Builder extends BaseBuilder{
/**
* Override getModels so it send attributes to the newInstance methods (in newExisting)
*/
public function getModels($columns = array('*'))
@cheeaun
cheeaun / putonglasses.txt
Created September 14, 2012 08:57
put on glasses unicode
•_•)
( •_•)>⌐■-■
(⌐■_■)