Skip to content

Instantly share code, notes, and snippets.

Takeshi Takahashi therealtakeshi

Block or report user

Report or block therealtakeshi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@LotteMakesStuff
LotteMakesStuff / TrafficLightAttribute.cs
Last active Dec 6, 2019
TrafficLight control/layout/property drawer: Adds a new editor control that draws lil Traffic Lights in the inspector. its really useful for visualizing state. For example, checkboxes can be hard to read at a glace, but a Red or Green status light is easy! Recommend you use the attached package, as it has all the icon image files.
View TrafficLightAttribute.cs
// Non Editor code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public abstract class TrafficLightAttribute : PropertyAttribute
{
public bool DrawLabel = true;
public string CustomLabel;
public bool AlsoDrawDefault;
View coding-styles.md

These examples are presented in an attempt to show how each coding styles attempts to or does not attempt to isolate side-effects. There are only 2 semantic elements in a barebone "Hello World" implementation:

  • Invocation of console.log
  • Declaration of HELLO_WORLD

Since every coding style can abstract away data into a parameter or variable, there is no point for us to show that. All implementations assume HELLO_WORLD is a constant that is always inlined. This way it reduces the variations we need to present. (To make an anology, if we were to implement incrementByOne, would we need to inline the number 1 or pass it in as parameter?)

CAVEAT/LIMITATION: All implementations also assume console is static global. In case of functional programming, console.log is asumed to be a function that can be passed around without further modification. (This is not the case in the browser, but that can be resolved with console.log.bind(console))

Declarative

@mynameisfiber
mynameisfiber / neighborhoods.json
Created Aug 13, 2014
Centroids for neighborhoods in Manhattan
View neighborhoods.json
[
{
"name": "Lower East Side",
"center": [
-73.9836180698,
40.7155233255
]
},
{
"name": "Marble Hill",
View hot-swap
#!/bin/bash
# This script assumes you have an app running on 2 ports 4040 and 4041
# and that you can restart your app with a single command
APP_RESTART_COMMAND="/your/app/control restart"
# Find out if the app is running
function app_up {
port=$1
View GIF-Screencast-OSX.md

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@ufologist
ufologist / CryptoJS-DES.html
Created May 15, 2013
Use CryptoJS encrypt message by DES and direct decrypt ciphertext, compatible with Java Cipher.getInstance("DES")
View CryptoJS-DES.html
<!-- test pass with CryptoJS v3.1.2 -->
<script src="rollups/tripledes.js"></script>
<script src="components/mode-ecb.js"></script>
<script>
/**
* Encrypt message by DES in ECB mode and Pkcs7 padding scheme
*
* NOTE: DES is weak, please use 3DES(Triple DES) or AES
*
* @param {String} message
@AvnerCohen
AvnerCohen / npm-cheat-sheet.md
Last active Nov 4, 2019
Node.js - npm Cheat Sheet
View npm-cheat-sheet.md

Node.js - npm Cheat Sheet

(Full description and list of commands at - https://npmjs.org/doc/index.html)

##List of less common (however useful) NPM commands

######Prepand ./bin to your $PATH Make sure to export your local $PATH and prepand relative ./node_modules/.bin/:

@turtlesoupy
turtlesoupy / nginx.conf
Created Jul 8, 2012
node.js upstream nginx config
View nginx.conf
http {
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m;
proxy_temp_path /var/tmp;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_comp_level 6;
@lancejpollard
lancejpollard / node-folder-structure-options.md
Created Nov 28, 2011
What is your folder-structure preference for a large-scale Node.js project?
View node-folder-structure-options.md

What is your folder-structure preference for a large-scale Node.js project?

0: Starting from Rails

This is the reference point. All the other options are based off this.

|-- app
|   |-- controllers
|   |   |-- admin
You can’t perform that action at this time.