Skip to content

Instantly share code, notes, and snippets.

View jnx's full-sized avatar
🎅

Christian Hjalmarsson jnx

🎅
View GitHub Profile
<tr>
<td><%=@key.split(".").drop(1) %></td>
<td><%= @value%></td>
</tr>
<!-- /app/views/admin/users/new_invitiations.html.erb -->
<h2>Send invitation</h2>
<%= form_for @user, :url => send_invitation_admin_users_path do |f| %>
<table style='width: 50%'>
<tr>
<td><%= f.label :first_name %></td>
<td><%= f.text_field :first_name %></td>
# 2010-10-01
#
# Mac OS X 10.6.3
# Homebrew 0.7
# Xcode 3.2.4
# Git 1.7.3.1
# RVM 1.0.12
# Ruby 1.8.7, 1.9.2
# Passenger 2.2.15
# MySQL 5.1.49
@jnx
jnx / sleep.js
Created May 28, 2011 06:47
Sleep function for Javascript
/* Usage
* alert("Hi");
* sleep(2000); // Sleep 2sec
* alert("Goodby");
*/
function sleep(milliseconds) {
var start = new Date().getTime();
for (var i = 0; i < 1e7; i++) {
if ((new Date().getTime() - start) > milliseconds){
@jnx
jnx / youtube.html
Created September 4, 2011 10:01
Show image of a youtubevideo
<!--
youtubemovue-url http://www.youtube.com/watch?v=FisvRkkS1_w
image-url http://img.youtube.com/vi/<youtube-id>/<image-id>.jpg
-->
<img src="http://img.youtube.com/vi/FisvRkkS1_w/0.jpg">
@jnx
jnx / Capfile
Created September 16, 2011 19:51 — forked from pal/Capfile
Complete Capistrano deployment example for a very simple PHP-site.
# Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
require 'rubygems'
require 'railsless-deploy'
load 'config/deploy'
@jnx
jnx / gist:1229355
Created September 20, 2011 15:09
Node.js Campfire bot
// main app.js
var client = require('ranger').createClient('ROOM',
'SECRET');
var timestamp = require('./timestamp').timestamp;
var getWeatherWrapper = require('./weather').getWeatherWrapper;
var showMap = require('./map').showMap;
var getTweets = require('./tweets').getTweets;
client.room(ROOMID, function(room) {
@jnx
jnx / gist:1232530
Created September 21, 2011 16:24 — forked from trevorturk/gist:1232220
Basecamp API: example uploading a file and attaching to a message
curl -v -H 'Accept: application/xml' -F Filedata=@/path/to/file https://trevorturk.basecamphq.com/upload
curl -v -H 'Accept: application/xml' -H 'Content-Type: application/xml' -u TOKEN:X \
-d "
<post>
<title>Test</title>
<body>Test</body>
<attachments>
<file>
<file>ID_FROM_FIRST_REQUEST</file>
@jnx
jnx / gist:1295423
Created October 18, 2011 13:30
Milestones
Discovery
kickoff → discovery approval
Design
discovery approval → design approval
Development
design approval → beta
Beta
@jnx
jnx / basecamp2github.rb
Created January 22, 2012 13:13 — forked from chip/basecamp2github.rb
Convert Basecamp tasks to Github issues
require 'rubygems'
require 'hash'
require 'active_resource'
require 'basecamp'
require 'httparty'
require 'json'
class GithubIssues
include HTTParty
base_uri "https://api.github.com"