Skip to content

Instantly share code, notes, and snippets.

@poc7667
poc7667 / active_admin.rb
Last active October 2, 2021 09:44
active admin / paper clip / images /
module ActiveAdmin::ViewHelpers
include ApplicationHelper
def show_image(p)
p.object.image.nil? ? p.template.content_tag(:span, "No Upload Image Yet") : p.template.image_tag(p.object.image.url(:small))
end
end
module ActiveAdmin
module Views
class Footer < Component
@poc7667
poc7667 / Gemfile
Last active May 6, 2019 01:51
Middleman Ruby
# If you have OpenSSL installed, we recommend updating
# the following line to use "https"
source 'http://rubygems.org'
gem "middleman", "~>3.3.4"
# Live-reloading plugin
gem "middleman-livereload", "~> 3.1.0"
# For faster file watcher updates on Windows:
@poc7667
poc7667 / style.css
Created May 20, 2014 09:04
css error Sass::SyntaxError: Invalid CSS after "}": expected selector or at-rule, was "}"
/************************
Designed by : http://responsivewebinc.com
************************/
/* Font Size */
@import url(http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,400,700,600);
@import url(http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,300italic,700);
/* Basic CSS starts */
body{
let prizesDictionary = prizes[0] as NSDictionary
let toPrizesArray = prizesDictionary["to_prizes"] as NSArray
self.items = toPrizesArray as [AnyObject] as [String]
@poc7667
poc7667 / gemfile_template.rb
Last active December 26, 2016 21:10
gemfile gems cheat sheet tools
#How to Use rails _4.0.0_ new $1 -m app_tmpl.rb -T --skip-bundle
# rails (4.0.0, 3.2.13, 3.2.12)
require 'ap'
require 'awesome_print'
app_name=@app_name
remove_file "README.rdoc"
create_file "README.md", "TODO"
create_file ".ruby-version"
@poc7667
poc7667 / Install-nginx-with-http2-support.md
Created September 26, 2016 23:12 — forked from hollodotme/Install-nginx-with-http2-support.md
Install nginx with http2 support on ubuntu 14.04 LTS (Trusty)

How to install nginx (>= 1.9.5) with http2 support on Ubuntu 14.04 LTS (Trusty)

IMPORTANT: Backup your nginx site configs (usually under /etc/nginx/sites-available)!

Remove old nginx

Remove old nginx incl. nginx-common:

apt-get autoremove --purge nginx nginx-common
@poc7667
poc7667 / Mysql_cheatsheet
Last active June 24, 2016 20:30 — forked from hofmannsven/README.md
My simply MySQL Command Line Cheatsheet
MySQL
===============
Getting started:
- http://www.sqlteaching.com/
- https://www.codecademy.com/courses/learn-sql
Related tutorials:
- MySQL-CLI: https://www.youtube.com/playlist?list=PLfdtiltiRHWEw4-kRrh1ZZy_3OcQxTn7P
- Analyzing Business Metrics: https://www.codecademy.com/learn/sql-analyzing-business-metrics
@poc7667
poc7667 / sample.rb
Created January 28, 2014 02:54
ruby fork , wait for pid, wait for timeout example
require 'timeout'
pid = fork do
puts "Forking ..."
sleep(10)
end
p "pid #{pid}"
begin
# Timeout.timeout(20) do
@poc7667
poc7667 / ref.txt
Created January 25, 2014 07:15
Implement signal handler in Pyhton
http://stackoverflow.com/questions/930519/how-to-run-one-last-function-before-getting-killed-in-python
@poc7667
poc7667 / streaming_verifications_controller.rb
Created January 24, 2014 10:15
How to write an better template form
class StreamingVerificationsController < ApplicationController
# GET /streaming_verifications
# GET /streaming_verifications.json
include StreamingVerificationsHelper
def index
# @streaming_verifications = StreamingVerification.all
@streaming_verifications = StreamingVerification.task_done
check_status()