Skip to content

Instantly share code, notes, and snippets.

@1gor
1gor / app.rb
Created September 11, 2013 07:16 — forked from troelskn/app.rb
require 'gollum/frontend/app'
require 'digest/sha1'
class App < Precious::App
User = Struct.new(:name, :email, :password_hash, :can_write)
before { authenticate! }
before /^\/(edit|create|delete|livepreview|revert)/ do authorize_write! ; end
helpers do
@1gor
1gor / nginx.conf
Last active August 29, 2015 14:07 — forked from abpin/nginx.conf
server {
listen :80;
server_name www.example.com;
rewrite ^/(.*) http://example.com/$1 permanent;
}
server {
server_name example.com;
listen :80;
#!/usr/bin/env ruby
require 'rest-client'
require 'bundler'
CHECK_GEMS_BEFORE = Time.parse("Feb 8, 2015")
def check_bundler
gems = Bundler::LockfileParser.new(Bundler.read_file("Gemfile.lock"))
gems.specs.each do |spec|
@1gor
1gor / app.rb
Created May 22, 2016 13:17 — forked from harmesy/app.rb
Simple mustache support for the cuba microframework (cuba.is)
require 'cuba'
require 'mustache'
require 'mustache_on_cuba'
Cuba.use Rack::Session::Cookie
Cuba.plugin MustacheOnCuba
Cuba.settings[:mustache] = {
views: File.join(File.dirname(__FILE__), "views"),
@1gor
1gor / 01-activerecord.rb
Created July 25, 2016 05:53 — forked from janko/01-activerecord.rb
PostgreSQL JSON querying in Sequel (my presentation from our local Ruby meetup)
require "active_record"
ActiveRecord::Base.establish_connection('postgres:///testing')
ActiveRecord::Migration.verbose = false
ActiveRecord::Migration.class_eval do
create_table :played_quizzes, force: true do |t|
t.integer :player_ids, array: true
t.json :quiz_snapshot
end
@1gor
1gor / 01.md
Created July 25, 2016 05:59 — forked from janko/01.md
The Roda Ruby framework (my presentation on our local Ruby meetups)

Roda

  • Web framework (on top of Rack)

  • Forked from Cuba

  • Core + Plugins

    • Core: 440 LOC
  • Total: 3200 LOC
@1gor
1gor / my_view.rb
Created August 12, 2016 11:55 — forked from defunkt/my_view.rb
Mustache Markdown Helper
class MyView < Mustache
def markdown(str = nil)
if str
Markdown.new(str.to_s).to_html
else
lambda { |text| markdown(render(text)) }
end
end
end
<?php
/**
* Plugin Name: Wp Remote Test
* Plugin URI:
* Version: 0.1
* Description: Debug wp_remote_get and wp_remote_post
* Author: Damian Logghe
* Author URI: http://wp.timersys.com
*/
@1gor
1gor / yahoo-finance-stock-data.js
Created November 16, 2016 09:42
Yahoo Finance stock historical data, prices and details retrieval function written in Javascript, jQuery and YQL
/*
Yahoo Finance stock historical data, prices and details retrieval function written in Javascript, jQuery and YQL
v2013-08-05
(c) 2013 by Fincluster ltd - http://fincluster.com <[email protected]>
*/
(function($) {
function getStock(opts, type, complete) {
var defs = {
desc: false,
baseURL: 'http://query.yahooapis.com/v1/public/yql?q=',