Skip to content

Instantly share code, notes, and snippets.

View cha0s's full-sized avatar
👌
Gettin' it

Ruben R cha0s

👌
Gettin' it
View GitHub Profile
@cha0s
cha0s / gist:2946163
Created June 18, 2012 00:29
TexTy UI 2.0
# jQuery.
$ = jQuery
# The slot where the next guessed letter will fall.
guessSlot = 0
# The prefix necessary to keep the letter lists centered.
prefix = 2
# Triggered when a guess is submitted.
@cha0s
cha0s / gist:2975596
Created June 22, 2012 22:43
mmm, coffee
app.register(
'.html'
compile: (source, options) ->
if typeof source isnt 'string' then source else
(options) ->
mustache.to_html(
source
<?php
function base_url() {
return (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . '/';
}
function path_parts() {
return array_filter(explode('/', parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)));
}
@cha0s
cha0s / gist:3033492
Created July 2, 2012 14:20
Dialogue syntax
Man:
Hey! HEY! Will you help me?!
Decide: Will you help him?
No:
Man:
:(...
// array = [
// "#{value.candidates[0]}:#{value.index}"
// value.argTypes.map (argType) -> {V: [newCustomValue argType]}
// ]
array->Set(0, String::New((value.candidates[0] + ":" + value.index).toAscii()));
Handle<Array> args = Array::New();
for (int i = 0; i < value.argTypes.length(); i++) {
Handle<Array> a = Array::New();
<?php
function transform_name($name) {
// Always remove .php.
$name = str_replace('.php', '', $name);
// Replace any non alphanumeric characters with '-'.
$name = preg_replace("[^a-zA-Z0-9", "-", $name);
// argument = if (customValue = newCustomValue type)?
// V: [customvalue]
// else
// I: [vicarValues(entity, type).shift().index]
Handle<Object> argument = Object::New();
Handle<v8::Value> customValue = newCustomValue(type);
if (!customValue->IsUndefined()) {
Handle<Array> a = Array::New();
// if (customValue = newCustomValue type)?
// V: [customvalue]
// else
// values = vicarValues entity, type
// I: [values[Object.keys(values)[0]].index]
Handle<Object> argument = Object::New();
Handle<v8::Value> customValue = newCustomValue(type);
if (!customValue->IsUndefined()) {
// argument = if (customValue = newCustomValue type)?
// V: [customvalue]
// else
// values = vicarValues entity, type
// I: [values[Object.keys(values).shift()].index]
// argument = if (customValue = newCustomValue type)?
// V: [customvalue]
// else
// values = vicarValues entity, type
// I: [values[Object.keys(values)[0]].index]