Skip to content

Instantly share code, notes, and snippets.

def panel(heading, options = {}, &block)
title = content_tag(:h3, heading, class: 'panel-title')
content_tag(:div,
content_tag(:div, title, class: 'panel-heading') +
content_tag(:div, capture(&block), class: 'panel-body'),
options.reverse_merge({class: "panel panel-default"}))
end
def modal(heading, options = {}, &block)
close_button = content_tag(:button, '×'.html_safe, class: 'close', data: { dismiss: 'modal' })
is_known_and_unique(Name) :-
student(Name, X, _),
student(Name, Y, _),
X \== Y.
@ramblex
ramblex / synccvs.sh
Created October 30, 2010 13:26
Export commits from git master to the current CVS checkout
#!/bin/bash
# Export commits from git master to the current CVS checkout. Expects a git tag
# called synccvs to point to the place in the git repo where CVS is up-to-date.
# Any commits between synccvs and master in git will be exported to CVS.
#
# Usage:
# ./synccvs.sh [-f]
#
# By default the script will only print out what would be committed to CVS. To
@ramblex
ramblex / comments.c
Created November 1, 2010 11:05
Some useful comments
if (tbsTable[searchPos] >= key) // If the value in the search position
{ // is greater than the number for
upperbound = searchPos - 1; // which we are searching, change
} // upperbound to the search position
else // minus one.
{ // Else, change lowerbound to search.
lowerbound = searchPos + 1;// position plus one.
}
<!DOCTYPE html>
%html
%head
%meta{:"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8"}
%title ONLINE KINGDOM
= stylesheet_link_tag 'screen'
= javascript_include_tag 'jquery'
= javascript_include_tag 'application', 'cufon-yui', 'Arial_Rounded_MT_Bold_400.font'
= javascript_tag "var AUTH_TOKEN = #{form_authenticity_token.inspect};" if protect_against_forgery?
= javascript_include_tiny_mce_if_used
<!DOCTYPE html>
<html>
<head>
<title>ONLINE KINGDOM</title>
<%= stylesheet_link_tag 'screen' %>
<%= javascript_include_tag 'jquery' %>
<%= javascript_include_tag 'application', 'cufon-yui', 'Arial_Rounded_MT_Bold_400.font' %>
<%= javascript_tag "var AUTH_TOKEN = #{form_authenticity_token.inspect};" if protect_against_forgery? %>
<%= javascript_include_tiny_mce_if_used %>
<%= tiny_mce if using_tiny_mce? %>
/**************************************************************************
*
* checkKi()
*
* Purpose: Calculates the value of Ki, with MCS table entry and Kt.
*
* (ki = kt - k0,i) and k0,i. is found in the MCS table.
*
* Args: UeConfig_t* - pointer to UE configuration structure
* HarqData_t* - pointer to HARQ data structure
In file included from /home/alexd/64qam/systems/products/lib/umtsfdd/rel6_200612/uplink/UlSched/src/UlSchedCtrl.vhd:148:
/home/alexd/64qam/systems/products/lib/umtsfdd/rel6_200612/uplink/UlSched/src/ulSchedCtrl.c: In function ‘handleTfciRach’:
/home/alexd/64qam/systems/products/lib/umtsfdd/rel6_200612/uplink/UlSched/src/ulSchedCtrl.c:1178: error: ‘DIAG_ULSCHED_BAD_TFCI’ undeclared (first use in this function)
/home/alexd/64qam/systems/products/lib/umtsfdd/rel6_200612/uplink/UlSched/src/ulSchedCtrl.c:1178: error: (Each undeclared identifier is reported only once
/home/alexd/64qam/systems/products/lib/umtsfdd/rel6_200612/uplink/UlSched/src/ulSchedCtrl.c:1178: error: for each function it appears in.)
/home/alexd/64qam/systems/products/lib/umtsfdd/rel6_200612/uplink/UlSched/src/ulSchedCtrl.c: In function ‘handleTfciDch’:
/home/alexd/64qam/systems/products/lib/umtsfdd/rel6_200612/uplink/UlSched/src/ulSchedCtrl.c:1282: error: ‘DIAG_ULSCHED_BAD_TFCI’ undeclared (first use in this function)
[Vhdl:Compiler:10] Error -
# Run a command and append stdout and stderr output into a logfile. If the
# command fails cat the logfile. When this is run in Hudson it allows for
# a nice clean console log and will show only the error log.
#
# Assumes that the last argument is the log file and the rest are a command
function run()
{
local cmd=${@:1:$#-1}
local logfile=${!#}
$cmd >> $logfile 2>&1
@ramblex
ramblex / gist:866888
Created March 12, 2011 01:04
Using haml for express views
var haml = require('haml');
/*
* Register .haml so that markdown complies with express view system by
* implementing a compile method
*/
app.register('.haml', {
compile: function(str, options) {
return function(locals) {
return haml.render(str, {locals: locals});