Skip to content

Instantly share code, notes, and snippets.

$(document).ready(function() {
$.ajax({
url: '/graphs/device1.json',
success: function (data) { load_chart(data) },
cache: false
});
});
def truncate(string)
# do something wonderful here
end
string = string.gsub(/regex/, '\1')
puts "Hey check out <a href="#{string}">#{truncate(string)}</a>"
@stw
stw / gist:953289
Created May 3, 2011 13:04
Soap service test
#!/usr/bin/env ruby
require 'rubygems'
require 'savon'
require 'pp'
url = "http://www.xignite.com/xFinancials.asmx?WSDL"
client = Savon::Client.new(url)
response = client.request :get_other_ratios do
@stw
stw / rails_3_1_beta_1_changes.md
Created May 12, 2011 18:36 — forked from ryanb/rails_3_1_rc4_changes.md
The Changelogs for Rails 3.1 Beta 1

Railties 3.1 Beta 1

  • The -j option of the application generator accepts an arbitrary string. If passed "foo", the gem "foo-rails" is added to the Gemfile, and the application JavaScript manifest requires "foo" and "foo_ujs". As of this writing "prototype-rails" and "jquery-rails" exist and provide those files via the asset pipeline. Default is "jquery". [fxn]

  • jQuery is no longer vendored, it is provided from now on by the jquery-rails gem. [fxn]

  • Prototype and Scriptaculous are no longer vendored, they are provided from now on by the prototype-rails gem. [fxn]

  • The scaffold controller will now produce SCSS file if Sass is available [Prem Sichanugrist]

@stw
stw / Tripwire Pi
Last active December 18, 2015 19:29
Quick stab at the tripwire code, nothing tested.
###
# You'll need the latest RPi.GPIO 0.5.2
# See here for some info:
# http://raspi.tv/2013/how-to-use-interrupts-with-python-on-the-raspberry-pi-and-rpi-gpio-part-2
#
# In Pin 8 - Push Button to disarm
# In Pin 10 - Laser broken
#
# Out Pin 12 - Alarm
###
@stw
stw / toggle.py
Created June 25, 2013 02:13
Simple RPi toggle switch
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
push_button = 17
led = 22
GPIO.setup(push_button, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(led, GPIO.OUT)
last = False
@stw
stw / bittrex.js
Created June 7, 2017 14:01
Pull Bittrex field
function search(nameKey, myArray){
for (var i=0; i < myArray.length; i++) {
if (myArray[i].MarketName === nameKey) {
return myArray[i];
}
}
}
function pullBittrex(market) {
var response = UrlFetchApp.fetch("https://bittrex.com/api/v1.1/public/getmarketsummaries");
@stw
stw / bittrex-timer.js
Created June 7, 2017 15:00
Bittrex w/ timer
function processResults(k, r) {
var c = [];
for (var i=0; i < Object.keys(r).length; i++) {
c.push([k[i], r[k[i]]]);
}
return c;
}
function search(nameKey, myArray){
for (var i=0; i < myArray.length; i++) {