This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'handlebars' | |
class HandlebarsHandler < ActionView::Template | |
def self.call(template) | |
# return "Hello World!" | |
<<-RUBY_CODE | |
template = Handlebars::Context.new.compile('#{template.source}') | |
vars = {} | |
partial_renderer = @view_renderer.send(:_partial_renderer) | |
vars.merge!(@_assigns) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef int (*iTOi) (int a); | |
int incr (int n) { return n+1; } | |
int decr (int n) { return n-1; } | |
void start(iTOi cc) { | |
printf("%d\n", cc(0)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
.button a { | |
-webkit-transition: 300ms all; | |
width: 32px; | |
height: 34px; | |
color: #333; | |
text-decoration: none; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main () { | |
FILE *file; file = fopen ( "app.c", "rt" ); | |
int c; if (file) while ( ( c = getc(file) ) != EOF ) putchar(c); | |
file ? fclose(file) : printf("Error: Problem Reading File.\n"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dom=""; | |
dom += " <div id=\"wrapper\">"; | |
dom += " "; | |
dom += ""; | |
dom += " <div id=\"header\" class=\"header header-logged-in\">"; | |
dom += " <div class=\"container clearfix\">"; | |
dom += " <a class=\"header-logo-blacktocat\" href=\"https:\/\/gist.github.com\/\">"; | |
dom += " <span class=\"mega-icon mega-icon-blacktocat\"><\/span>"; | |
dom += " <span class=\"logo-subbrand\"><img alt=\"GitHub:Gist\" height=\"25\" src=\"https:\/\/gist.github.com\/assets\/modules\/header\/[email protected]\"><\/span>"; | |
dom += " <\/a>"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(var i = 0; i < 10; i++) !function (n) { | |
console.log(n) | |
}(i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function.prototype.method = function (name, func) { | |
this.prototype[name] = func; | |
return this; | |
} | |
var getParamNames = function (func) { | |
var funStr = func.toString() | |
return funStr.slice(funStr.indexOf('(')+1, funStr.indexOf(')')).match(/([^\s,]+)/g) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Make it Nasty | |
function increment (i) { | |
i ^= (i & ~-~i) | (~i & -~i) | |
return i | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var list = [1, 3, 5, 5, 23, 23, 4, 3, 3, 6, 7, 4, 2, 2, 5] | |
var groups = {} | |
list.forEach(function (n) { | |
if (groups[n]) groups[n].push(n) | |
else groups[n] = [n] | |
}) | |
var result = [] | |
for (var group in groups) result.push(groups[group]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fatify (str) { | |
return str.replace(/[\.,-\/#!$%\^&\*;:{}=\-_`~()]/g,"").toLowerCase() | |
} |
OlderNewer