Skip to content

Instantly share code, notes, and snippets.

View defeated's full-sized avatar
💭
I may be slow to respond.

eddie cianci defeated

💭
I may be slow to respond.
View GitHub Profile
@defeated
defeated / gulpfile.js
Created April 12, 2015 15:28
gulp-postcss + autoprefixer
var gulp = require('gulp'),
postcss = require('gulp-postcss'),
autoprefix = require('autoprefixer-core');
gulp.task('css', function() {
return gulp.src('test.css')
.pipe(postcss([ autoprefix() ]))
.pipe(gulp.dest('dist/css'));
});
private string GetTemperatureViaSOAP11() {
var results = string.Empty;
var url = "http://ws.cdyne.com/WeatherWS/Weather.asmx";
var ns = "http://ws.cdyne.com/WeatherWS/";
var soap = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>"
+ "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+ " <soap:Body>"
+ " <GetCityWeatherByZIP xmlns=\"{1}\">"
+ " <ZIP>{0}</ZIP>"
+ " </GetCityWeatherByZIP>"
private string GetTemperatureViaHTTPGET() {
var results = string.Empty;
var url = "http://ws.cdyne.com/WeatherWS/Weather.asmx/GetCityWeatherByZIP?ZIP=" + zipcode.Text;
using(var web = new WebClient())
using(var stream = web.OpenRead(new Uri(url)))
using(var reader = new StreamReader(stream)) {
results = reader.ReadToEnd();
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web.Mvc;
using System.Web.Routing;
/*
* TODO:
* auto_discovery_link_tag
<script type="text/javascript">
jQuery(function($){
$.fn.num = function(){
var val = $(this).val();
return (isNaN(val) || val == null) ? 0 : parseInt(val);
}
});
</script>
<!-- usage -->
# create fresh git repo
git :init
git :add => '.'
git :commit => '-a -m "fresh rails app"'
# include gems
gem 'rspec', '>= 2.0.0.beta.19', :group => :test
gem 'rspec-rails', '>= 2.0.0.beta.19', :group => :test
gem 'cucumber', '>= 0.8.5', :group => :test
gem 'cucumber-rails', '>= 0.3.2', :group => :test
# Ruby Koans - Greed Game - scoring method
# from http://rubykoans.com http://edgecase.com
# * A set of three ones is 1000 points
# * A set of three numbers (other than ones) is worth 100 times the
# number. (e.g. three fives is 500 points).
# * A one (that is not part of a set of three) is worth 100 points.
# * A five (that is not part of a set of three) is worth 50 points.
# * Everything else is worth 0 points.
@defeated
defeated / users.yml
Created September 20, 2011 17:07
Devise User Fixture
one:
email: e@mail.com
encrypted_password: <%= User.new.send(:password_digest, "password") %>
authentication_token: <%= User.authentication_token %>
@defeated
defeated / gist:1975752
Created March 5, 2012 01:11 — forked from dhh/gist:1975644
safer mass assignment from dhh
class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private
it "should create a new test set" do
expect { @preview_test.save }.should change(user.test_sets, :count).by(1)
@preview_test.test_set.tap do |t|
t.account.should == account
t.user.should == user
t.service.should == email_service
end.should be_valid
end