This file contains 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
# used to alter columns in postgresql | |
module AlterColumn | |
def alter_column(table_name, column_name, new_type, mapping, default = nil) | |
drop_default = %Q{ALTER TABLE #{table_name} ALTER COLUMN #{column_name} DROP DEFAULT;} | |
execute(drop_default) | |
# puts drop_default | |
base = %Q{ALTER TABLE #{table_name} ALTER COLUMN #{column_name} TYPE #{new_type} } | |
if mapping.kind_of?(Hash) | |
contains_else = mapping.has_key?("else") |
This file contains 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
// webserver.go | |
package main | |
import ( | |
"fmt" | |
"net/http" | |
// "net/url" | |
) | |
func AbHandler(w http.ResponseWriter, r *http.Request) { |
This file contains 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
cd ~ | |
sudo add-apt-repository ppa:dlecan/openjdk | |
sudo apt-get update | |
sudo apt-get install openjdk-7-jre -y | |
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.7.tar.gz -O elasticsearch.tar.gz | |
tar -xf elasticsearch.tar.gz | |
rm elasticsearch.tar.gz | |
sudo mv elasticsearch-* elasticsearch | |
sudo mv elasticsearch /usr/local/share |
This file contains 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
// Expanded on Filip Ekberg's gist: https://gist.github.com/fekberg/bac40e784113dd75c03e | |
// See his tweet @fekberg for more https://twitter.com/fekberg/status/410964845870071808 | |
// Not perfect, but still amusing. | |
using System; | |
using System.Media; | |
using System.Speech.Synthesis; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using System.Collections.Generic; |
This file contains 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
""" | |
Testing out the py mini racer v8 interface with Douglas Crockford's jslint.js from http://www.jslint.com/. | |
""" | |
import sys | |
from py_mini_racer import py_mini_racer | |
HTML_PAGE_FORMAT = """<!DOCTYPE html> | |
<head> | |
<meta charset="utf-8"> |
This file contains 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
// Simple spreadsheet, with first sheet containing form submission repsonses | |
// when the form is submitted: | |
// 1) grab the latest response, | |
// 2) post it to a third party service via an HTTP POST | |
function testWebhook() { | |
var ss = SpreadsheetApp.openById(SPREADSHEET_ID); | |
var form=ss.getSheets()[0]; | |
var lr=form.getLastRow(); | |
var el=form.getRange(lr,2,1,1).getValue(); | |
var t=el; |
This file contains 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 src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script> | |
<script src="http://yandex.st/raphael/1.5.2/raphael.min.js"></script> | |
<script> | |
/** | |
* A Simple Vector Shape Drawing App with RaphaelJS and jQuery | |
* copyright 2010 Kayla Rose Martin - Licensed under the MIT license | |
* Inspired by http://stackoverflow.com/questions/3582344/draw-a-connection-line-in-raphaeljs | |
**/ |
This file contains 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
<?php | |
/** | |
* PDO SINGLETON CLASS, ADODB ENABLED | |
* | |
* @author Tony Landis | |
* @link http://www.tonylandis.com | |
* @license Use how you like it, just please don't remove or alter this PHPDoc | |
*/ | |
class sdb | |
{ |
This file contains 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
/** | |
* Description: | |
* removes white space from text. useful for html values that cannot have spaces | |
* Usage: | |
* {{some_text | nospace}} | |
*/ | |
app.filter('nospace', function () { | |
return function (value) { | |
return (!value) ? '' : value.replace(/ /g, ''); |
This file contains 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/php | |
<?php | |
/** | |
* The Analyzer class. | |
*/ | |
class Analyzer { | |
private $fp; |
OlderNewer