Skip to content

Instantly share code, notes, and snippets.

@H1D
H1D / code.py
Created April 14, 2012 12:40
Python "import this"
import this
@H1D
H1D / gist:3764514
Created September 21, 2012 23:33
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<link rel="stylesheet" href="iui.css" type="text/css" />
<link rel="stylesheet" href="t/default/default-theme.css" type="text/css"/>
<script type="application/x-javascript" src="iui.js"></script>
<style type="text/css">
@H1D
H1D / robot.js
Created December 5, 2012 11:51 — forked from Shipow/robot.js
Shipow#001
var Robot = function(robot) {
robot.rotateCannon(-90);
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead();
//i'll add a clone but i need to refactor collision
//robot.clone();
};
@H1D
H1D / gist:5458833
Created April 25, 2013 10:25
Gruntfile
#global module:false
module.exports = (grunt) ->
# Project configuration.
grunt.initConfig
meta:
version: "0.1.0"
banner: "/*! PROJECT_NAME - v<%= meta.version %> - " + "<%= grunt.template.today(\"yyyy-mm-dd\") %>\n" + "* http://PROJECT_WEBSITE/\n" + "* Copyright (c) <%= grunt.template.today(\"yyyy\") %> " + "YOUR_NAME; Licensed MIT */"
@H1D
H1D / gist:5600198
Last active December 17, 2015 11:09
Ember.js autoclass for testing
#adds class '<fieldname>' or '<relatedmodel__fieldname>' based on valueBinding
Em.View.reopen
init: ->
@_super.apply(@, arguments)
if Em.testing
testing_class = this.valueBinding?._from?.match(/[\w|\d]+\.[\w|\d]+$/)?[0]
if testing_class
testing_class = testing_class.replace('context.','').replace('.','__')
classes = @get('classNames') || []
classes.push testing_class
@H1D
H1D / gist:5643332
Created May 24, 2013 13:02
Ember automatic template loading
# load templates for routes
Em.Route.reopen
renderTemplate: ->
# ignore *.index routes
if @routeName.match /\.index$/
return
name = @routeName.replace(/\./g, '/')
tmpl_path = @templateName || name
_this = this
@H1D
H1D / .gitconfig
Created February 17, 2014 12:35
How to use DiffMerge with git
[diff]
external = ~/git-diff.sh
[merge]
tool = diffmerge
[mergetool "diffmerge"]
cmd = "diffmerge --merge --result=\"$MERGED\" \"$LOCAL\" \"$(if test -f \"$BASE\"; then echo \"$BASE\"; else echo \"$LOCAL\"; fi)\" \"$REMOTE\""
trustExitCode = true
[difftool "diffmerge"]
cmd = diffmerge \"$LOCAL\" \"$REMOTE\"
[mergetool]
@H1D
H1D / file-upload.hbs
Created March 28, 2014 09:41
with file upload ember jquery-file-upload
<input type="file" class="fileupload__input" name="{{unbound name_attr}}">
<button class="fileupload__button" {{bind-attr disabled="disabled"}}>
{{#unless upload_progress}}
{{unbound text}}
{{else}}
{{upload_progress}}
{{/unless}}
</button>
@H1D
H1D / application.coffee
Last active August 29, 2015 14:00
emberjs login-link component
App.ApplicationController = Em.Controller.extend
login: ->
if App.get('user')
Em.RSVP.resolve()
else
# try to log in via sessionid
new Ember.RSVP.Promise (resolve, reject)=>
# your login implementation here
# get cookie here and try to set App.user
# call reject() when fail