Skip to content

Instantly share code, notes, and snippets.

@nicohvi
nicohvi / index.html
Created February 13, 2013 14:51
Netflix oData
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>title</title>
<script type="text/javascript" src="assets/javascripts/jQuery.js"></script>
<style>
.big {
font-size: 42pt;
}
@nicohvi
nicohvi / gist:7248457
Created October 31, 2013 11:52
Modular javascript
var Order = function($el) {
// private variables
el = $el;
// public API
var Order = {
removeTarget: function() {
el.find('#order-target').remove();
info: Welcome to Nodejitsu nicohvi
info: jitsu v0.13.14, node v0.10.15
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Analyzing application dependencies in coffee marvin.coffee
debug: { method: 'GET',
debug: uri: 'https://api.nodejitsu.com/apps/nicohvi/marvin',
debug: headers:
debug: { Authorization: '*****************************************************************',
debug: 'Content-Type': 'application/json',
ReactTransition = React.addons.CSSTransitionGroup
Component = React.createClass
displayName: 'component'
render: ->
section className: 'component',
ReactTransition transitionName: 'fadeIn',
SubComponent()
@nicohvi
nicohvi / hof.js
Last active August 29, 2015 14:05
Functional programming
function whosTopDog(dogs, comparison) {
for (var i=0; i < dogs.length; i++) comparison(dogs[i]);
}
whosTopDog(['ice cube', '50 cent', 'snoop'], function(dog) {
if(dog === 'snoop dog') {
console.log(dog+ ' is top deg.');
}
else {
console.log(dog+ ' is a bitch.');
while true do
p 'You done fucked up son'
end
Given /^the person "(.*?)" should not be "(*.?)"$/
@nicohvi
nicohvi / sprockets.rb
Created November 7, 2014 08:48
Ruby script for compiling haml and coffeescript
require 'haml'
require 'coffee-script'
@root = Dir.pwd
@coffee = "#{@root}/_coffee"
@haml = "#{@root}/_haml"
def compile_coffeescript
target, javascript = "#{@root}/public/application.js", '' # 1
Dir.glob("#{@coffee}/*.coffee") do |coffeescript| # 2
require 'listen'
require 'haml'
require 'coffee-script'
require 'uglifier'
@root = Dir.pwd
@haml = "#{@root}/_haml"
@coffee = "#{@root}/_coffee"
def compile_haml(file)
require 'minitest/autorun'
require 'byebug'
def stack_machine(string)
result = []
numbers = []
string.split.each do |token|
if /(\d)/.match(token)
numbers << Integer(token)