Skip to content

Instantly share code, notes, and snippets.

@jweir
jweir / protovis_to_link.js
Created November 19, 2010 19:23
How to save SVG data to a file from a web browser
@tsurushuu
tsurushuu / gist:1257473
Created October 2, 2011 13:51
Graph test
module Main where
import System.Cmd
import Data.Graph.Inductive
import Data.Graph.Inductive.Graphviz
import Data.Graph.Inductive.Example
myGraph :: Gr String ()
myGraph = mkGraph
@rn0
rn0 / README.markdown
Created February 20, 2012 00:22 — forked from gudbergur/README.markdown
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is an extension to Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
@bobmonteverde
bobmonteverde / d3.css
Created March 18, 2012 09:18
A Simple D3 Line chart with Legend and Tooltips
/********************
* TOOLTIP CSS
*/
.nvtooltip {
position: absolute;
background-color: rgba(255,255,255,1);
padding: 10px;
border: 1px solid #ddd;
@havvg
havvg / ajax-form.js
Created August 1, 2012 13:20
jQuery AJAX form submit with Twitter Bootstrap modal
jQuery(function($) {
$('form[data-async]').live('submit', function(event) {
var $form = $(this);
var $target = $($form.attr('data-target'));
$.ajax({
type: $form.attr('method'),
url: $form.attr('action'),
data: $form.serialize(),
@jacobsimeon
jacobsimeon / References.sql
Created August 28, 2012 16:18
List tables with foreign key that references a given table
select t.name as TableWithForeignKey, fk.constraint_column_id as FK_PartNo , c.name as ForeignKeyColumn
from sys.foreign_key_columns as fk
inner join sys.tables as t on fk.parent_object_id = t.object_id
inner join sys.columns as c on fk.parent_object_id = c.object_id and fk.parent_column_id = c.column_id
where fk.referenced_object_id = (select object_id from sys.tables where name = 'PriorAuthorizationRequests')
order by TableWithForeignKey, FK_PartNo
@jonsuh
jonsuh / js-ajax-php-json-return.html
Last active September 17, 2022 02:57
jQuery AJAX Call to PHP Script with JSON Return
<div class="the-return">
[HTML is replaced when successful.]
</div>
@cgmartin
cgmartin / FileUploadForm.php
Created September 28, 2012 04:51
ZF2 File Upload PR Examples
<?php
namespace Application\Form;
use Zend\Form\Form;
use Zend\Form\Element;
class FileUploadForm extends Form
{
public function __construct($name = null, $options = array())
@ssayala
ssayala / piechart.js
Created October 3, 2012 05:17
PhantonJS Highcharts
var system = require('system');
var page = require('webpage').create();
var fs = require('fs');
page.injectJs("jquery-1.8.2.min.js") || ( console.log("Unable to load jQuery") && phantom.exit());
page.injectJs("highcharts.js") || ( console.log("Unable to load Highcharts") && phantom.exit());
page.injectJs("exporting.js") || (console.log("Unable to load Highcharts") && phantom.exit());
page.onConsoleMessage = function (msg) {
console.log(msg);
@staatzstreich
staatzstreich / ftp_download.php
Created November 30, 2012 12:45
Download a directory from an FTP Server
<?php
// ftp_sync - copy directory and file structure
// based on http://www.php.net/manual/es/function.ftp-get.php#90910
// main function witch is called recursivly
function ftp_sync($dir, $conn_id) {
if ($dir !== '.') {
if (ftp_chdir($conn_id, $dir) === FALSE) {
echo 'Change dir failed: ' . $dir . PHP_EOL;
return;