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
class AppSettings::Base | |
@show_info = true | |
class << self | |
attr_accessor :cells | |
attr_accessor :show_info | |
end | |
def self.setup(&block) | |
yield(self) | |
end |
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
.container | |
%h1 Todo List | |
%ul.todos(data-bind="foreach: todos") | |
%li(data-bind="attr: {class: className}") | |
%input(type="checkbox" data-bind="checked: completed") | |
%span(data-bind="text: title") | |
%a(data-bind="visible: allowClear, click: clearList") Clear List | |
%input(type="text" placeholder="New Todo Title" data-bind="value: todoToAdd, event: {change: addTodo}") | |
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
+ def ble # concatenates everything and you can render whole part in partial by calling yield :ble, or content_for :ble | |
+ content_for :ble, content_tag(:p, "Here form starts:") | |
+ content_for :ble, content_tag(:p, "Here form starts:") | |
+ content_for :ble, content_tag(:p, "Here form starts:") | |
+ content_for :ble, content_tag(:p, "Here form starts:") | |
+ render "shared/bootstrap/ble" | |
+ end | |
+ | |
+ def ble2 # you can render everything on the end of helper as well | |
+ content_for :ble, content_tag(:p, "Here form starts: asdfasdf") |
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
# Usage: redis-cli publish message.achannel hello | |
require 'sinatra' | |
require 'redis' | |
conns = Hash.new {|h, k| h[k] = [] } | |
Thread.abort_on_exception = true | |
get '/' do |
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
class ApplicationController < ActionController::Base | |
# Creates an accessor which is exposed to the view | |
def self.view_accessor(*names) | |
attr_accessor *names | |
helper_method *names | |
end | |
end |
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
- roles = [] | |
- roles << {"Can manage users" => {:scope =>["reza", "waitline"]}} | |
- roles << {"Can change settings" => {:scope =>["pssurvey"]}} | |
- roles << {"Can use" => {:scope =>["account"]}} | |
.container | |
.row | |
.span12 | |
= ko_context system: {users: {"Arek" => roles, "田中" => roles }}, settings: [1,2,3] do | |
/ko foreach: window.s = new System(context.model.system).users |
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
class Assignment | |
constructor: (o) -> | |
$.map o, (v,k) => | |
@name = k | |
@app = v | |
class System | |
constructor: (o) -> | |
@users = $.map o.users, (v,k) => | |
new User(k,v) |
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/env ruby | |
require "aws-sigv4" | |
require "aws-sdk-core" | |
require "active_support/all" | |
require "aws-eventstream" | |
require "excon" | |
BUCKET_NAME = ARGV[0] |
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
require "json" | |
require "websocket-eventmachine-client" | |
require "securerandom" | |
require 'date' | |
require "base64" | |
API_HOST = "CHANGEME.appsync-api.ap-northeast-1.amazonaws.com" | |
API_KEY = "da2-CHANGEME" | |
REAL_TIME_HOST = API_HOST.gsub("appsync-api","appsync-realtime-api") |
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
``` | |
## based on: https://docs.python.org/2/extending/embedding.html | |
arek@qyobo:~/workspace/embeding_python$ gcc -I/usr/include/python2.7 -I/usr/include/x86_64-linux-gnu/python2.7 main.c -lpython2.7 -o run-python | |
arek@qyobo:~/workspace/embeding_python$ cat main.c | |
#include "Python.h" | |
int | |
main(int argc, char *argv[]) | |
{ |