This file contains hidden or 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
public function someController() | |
{ | |
// $callback is retrieved from the params | |
$message = "some message"; | |
$this->autoRender = false; | |
$this->RequestHandler->respondAs('json'); | |
if ($cb) echo $callback."(".json_encode(array("message" => $message)).");"; | |
} |
This file contains hidden or 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
// center an element | |
$(element).center | |
jQuery.fn.center = function () { | |
this.css("position","absolute"); | |
this.css("top", (($(window).height() - this.outerHeight()) / 2) + | |
$(window).scrollTop() + "px"); | |
this.css("left", (($(window).width() - this.outerWidth()) / 2) + |
This file contains hidden or 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 'rubygems' | |
require 'capybara' | |
require 'capybara/dsl' | |
Capybara.run_server = false | |
Capybara.current_driver = :selenium | |
Capybara.app_host = 'http://www.google.com' | |
module MyCapybaraTest | |
class Test |
This file contains hidden or 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
$(document).ready(function() { | |
// set your twitter id | |
var user = 'quenesswebblog'; | |
// using jquery built in get json method with twitter api, return only one result | |
$.getJSON('http://twitter.com/statuses/user_timeline.json?screen_name=' + user + '&count=1&callback=?', function(data) { | |
// result returned | |
var tweet = data[0].text; |
This file contains hidden or 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
<html> | |
<head> | |
.. | |
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> | |
<script type="text/javascript">if (typeof jQuery == 'undefined') document.write(unescape("%3Cscript src='/path/to/your/jquery' type='text/javascript'%3E%3C/script%3E"));</script> | |
</head> | |
<body> | |
.. | |
<!-- some jquery using scripts --> |
This file contains hidden or 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
#!/usr/bin/env ruby | |
puts "hello!" | |
puts "location to env: #{`which env`}" | |
puts "location to ruby: #{`which ruby`}" |
This file contains hidden or 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
#!/bin/sh | |
# A shell script that tries its best to convert documents thrown at it | |
# to pandoc's extended markdown. | |
# | |
# Depends on: | |
# | |
# + textutil: an OS X only command line utility | |
# + odt2pandoc.py: a tweaked version of odt2txt.py | |
# + pdftohtml: a utility for converting pdf to html |
This file contains hidden or 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
#!/bin/bash | |
GITOLITE_ADMIN_DIR=/home/$USERNAME/workspace/gitolite-admin | |
GITOLITE_CONF=$GITOLITE_ADMIN_DIR/conf/gitolite.conf | |
GITSERVER=gitserver | |
SSHSTRING="ssh root@vps" | |
PATHTOREPOS="/home/develop/repositories" | |
GITHUB_USER=$USERNAME | |
GITHUB_TOKEN="<GITHUBTOKEN>" | |
#REMOTENAMES="origin gitolite" # $GITSERVER is always added as a REMOTENAME |
This file contains hidden or 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
#!/bin/sh | |
# | |
# graylog2-server: graylog2 message collector | |
# | |
# chkconfig: - 98 02 | |
# description: This daemon listens for syslog and GELF messages and stores them in mongodb | |
# | |
CMD=$1 | |
NOHUP=`which nohup` |