Skip to content

Instantly share code, notes, and snippets.

View gist:87dd6b7a95dd100419a6
<script language="JavaScript">
channel="B2C";
subchannel="PUB";
</script><script type="text/javascript" src="http://www.cocha.com/static/scripts/Cocha/s_code.js"></script><script language="JavaScript">
/* You may give each page an identifying name, server, and channel on
the next lines. */
s.pageName="Home Cocha ";
s.server="";
s.channel=s.pageName;
View gist:9625206
String header = Settings.PREFERENCES.getString(Settings.PHONE_PREF, null)+ ":"+ Settings.PREFERENCES.getString(Settings.PASSWORD_PREF, null);
Log.i("header" , header);
byte[] data64 = null;
try {
data64 = header.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
JSONObject json = new JSONObject();
View gist:7896281
= simple_form_for [@store, @item] do |f|
= f.label :happy_hour
= f.label :happy_hour, "Yes", value: true, style: "display:inline"
= f.radio_button :happy_hour, true, checked: @item.happy_hour
= f.label :happy_hour, "No", value: false, style: "display:inline"
= f.radio_button :happy_hour, false, checked: !@item.happy_hour
= f.submit "Guardar", class: "large button radius"
#<Item _id: 5267c8f167cd8acb5b000004, created_at: 2013-10-23 13:02:42 UTC, updated_at: 2013-12-10 18:54:55 UTC, store_id: "5252fdf424f1e7fbf7000004", happy_hour: "true">
View gist:7405186
App.ApplicationRoute = Ember.Route.extend(
setupController: (controller, data) ->
store = @get 'store'
socket = io.connect "http://localhost:4000/orders"
socket.on "new_order", (order) ->
store.load(App.Order, order)
socket.on "new_billing", (bill) ->
store.load(App.Bill, bill)
socket.on "connected", ->
console.log "Ready"
View gist:7105078
array = selection.present_in.clone # ["5266b31224f1e7116f000008"]
array.delete("5266b31224f1e7116f000008")
=> nil
View gist:6994511
actionpack (4.0.0) lib/action_controller/metal/mime_responds.rb:372:in `retrieve_collector_from_mimes'
actionpack (4.0.0) lib/action_controller/metal/mime_responds.rb:189:in `respond_to'
app/controllers/items_controller.rb:73:in `search'
actionpack (4.0.0) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.0.0) lib/abstract_controller/base.rb:189:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.0.0) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (4.0.0) lib/active_support/callbacks.rb:414:in `block in _run__4491803589333142600__process_action__callbacks'
activesupport (4.0.0) lib/active_support/callbacks.rb:212:in `block in _conditional_callback_around_624'
activesupport (4.0.0) lib/active_support/core_ext/time/zones.rb:45:in `use_zone'
View gist:6993437
def index
if params[:query]
respond_to do |format| # ActionController::UnknownFormat
if params[:type] == "name"
@items = @store.items.where(name: params[:query])
format.js
elsif parms[:type] == "category"
@items = @store.items.where(category: params[:query])
format.js
end
View gist:6490163
var express = require('express');
var io = require('socket.io');
var redis = require("redis");
var url = require("url");
var server = express.createServer();
var port = process.env.PORT || 3000;
server.configure(function() {
server.set('view engine', 'html');
You can’t perform that action at this time.