Skip to content

Instantly share code, notes, and snippets.

{
"person":{
"id":2370365,
"first_name":"Kenneth John",
"last_name":"Balgos",
"gender":"Male",
"campus":"",
"year_in_school":"Graduated",
"major":"",
"minor":null,
@twinge
twinge / gist:1542657
Created December 31, 2011 03:08
weirdness on setting commissions
# set commission only for non artists or artists whose not buying their own art
Rails.logger.debug '*' * 100
Rails.logger.debug "artist id: #{User.current.artist.id} product id: #{li.product.id} (#{!User.current.artist}) || (#{User.current.artist && !User.current.artist.products.include?(li.product)})"
li.set_commissions if !User.current.artist || (User.current.artist && !User.current.artist.products.include?(li.product))
## _form.html.erb ##
<%= link_to(image_tag(element.element_data.url(:thumb)), portfolio_add_element_path(element), :remote=>true) %>
## Portfolios_Controller.rb ##
respond_to :js, :html
def add_element
@portfolio = Portfolio.find(portfolio_id)
@element = Element.find(element_id)
<?php
//Show category?
if ($cat_link_string != ''){
$output = '<p><strong>' . $cat_link_string . '</strong></p>';
}else{
$output = '';
}
$output .= '<ul class="lcp_catlist">';//For default ul
@twinge
twinge / gist:322298
Created March 5, 2010 00:12 — forked from anonymous/gist:322297
asdf.asp
foreach (var dimType in ViewData.Model.SelectedProduct.DimensionTypes)
{
string ddlName = String.Format("ddlDimension_{0}", dimType.Key);
var dimensions = variations.Select(sv => sv.Dimensions.FirstOrDefault(d => d.TypeKey == dimType.Key));
var valueList = dimensions
.Select(d => new { Key = d.Key, ShortValue = d.ShortValue, IsInStock = variations.Any(sv => sv.Available && sv.Dimensions.Any(sd => sd.Key == d.Key)) })
.Distinct()
.OrderBy(d => DimensionSorter.GetSortOrder(d.Key))
.ToList();
= render :partial => 'users/activity_tabs', :locals => {:selected => 'Wall'}
.listing
- unless displaying_dashboard?
%div.wallsectionhead
%h3
Leave a Comment for
= @user.login
= spinner('wall')
.comment_box
- remote_form_for([@user, @user.comments.new], :before => "Element.show('spinner_wall')") do |f|
<?php
session_start();
if (count($_FILES)) {
// Handle degraded form uploads here. Degraded form uploads are POSTed to index.php. SWFUpload uploads
// are POSTed to upload.php
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
if (isset($_POST["PHPSESSID"])) {
session_id($_POST["PHPSESSID"]);
}
session_start();
if (!isset($_FILES["Filedata"]) || !is_uploaded_file($_FILES["Filedata"]["tmp_name"]) || $_FILES["Filedata"]["error"] != 0) {
// Usually we'll only get an invalid upload if our PHP.INI upload sizes are smaller than the size of the file we allowed
// to be uploaded.
header("HTTP/1.1 500 File Upload Error");