Skip to content

Instantly share code, notes, and snippets.

View seyyah's full-sized avatar

seyyah seyyah

View GitHub Profile
@seyyah
seyyah / Gruntfile.coffee
Created January 23, 2017 05:47 — forked from naps62/Gruntfile.coffee
quick Grunt.js setup with Sass + Coffee + Slim
module.exports = (grunt) ->
# configuration
grunt.initConfig
# grunt sass
sass:
compile:
options:
style: 'expanded'
@seyyah
seyyah / qemu-system-raspberry.sh
Created December 8, 2016 11:01 — forked from FrankSpierings/qemu-system-raspberry.sh
Run Raspberry Pi in qemu-system-arm using versatilepb 'hardware'
#!/bin/sh
#https://github.com/dhruvvyas90/qemu-rpi-kernel/raw/master/kernel-qemu-4.4.13-jessie
KERNEL=kernel-qemu-4.4.13-jessie
#https://downloads.raspberrypi.org/raspbian_lite_latest + https://github.com/dhruvvyas90/qemu-rpi-kernel/wiki/Emulating-Jessie-image-with-4.x.xx-kernel
IMAGE=2016-05-27-raspbian-jessie-lite.img
export QEMU_AUDIO_DRV="none"
qemu-system-arm -kernel ${KERNEL} \
-cpu arm1176 \
-m 256 \
-M versatilepb \
@seyyah
seyyah / sessions_and_conversations.markdown
Last active December 5, 2016 07:13 — forked from jcasimir/sessions_and_conversations.markdown
Sessions and Conversations in Rails 3

Sessions and Conversations

HTTP is a stateless protocol. Sessions allow us to chain multiple requests together into a conversation between client and server.

Sessions should be an option of last resort. If there's no where else that the data can possibly go to achieve the desired functionality, only then should it be stored in the session. Sessions can be vulnerable to security threats from third parties, malicious users, and can cause scaling problems.

That doesn't mean we can't use sessions, but we should only use them where necessary.

Adding, Accessing, and Removing Data

class ApplicationController < ActionController::Base
include Pundit
# Verify that controller actions are authorized. Optional, but good.
after_filter :verify_authorized, except: :index
after_filter :verify_policy_scoped, only: :index
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
private
@seyyah
seyyah / test.m
Created October 7, 2016 11:35
test
function y=x
source 'https://rubygems.org'
gem 'rails', '4.2.0'
gem 'sass-rails', '>= 3.2'
gem 'uglifier'#, '>= 1.3.0'
gem 'coffee-rails'#, '~> 4.1.0'
gem 'jquery-rails'
gem 'jbuilder'#, '~> 2.0'
gem 'execjs'
gem 'therubyracer'

Intro

The plan is to create a pair of executables (ngrok and ngrokd) that are connected with a self-signed SSL cert. Since the client and server executables are paired, you won't be able to use any other ngrok to connect to this ngrokd, and vice versa.

DNS

Add two DNS records: one for the base domain and one for the wildcard domain. For example, if your base domain is domain.com, you'll need a record for that and for *.domain.com.

Different Operating Systems

% http://stackoverflow.com/questions/27693593/color-correcting-images-in-matlab
% https://ia802707.us.archive.org/23/items/Lectures_on_Image_Processing/EECE253_05_ColorCorrection.pdf
close all;
clear all;
im1 = imread('http://i.stack.imgur.com/GtgHU.jpg');
im2 = imread('http://i.stack.imgur.com/wHW50.jpg');
rng(123); %// Set seed for reproducibility
num_colours = 2000;
ind = randperm(numel(im1) / size(im1,3), num_colours);
td= truncate(period.program.name, length: 30)
td= truncate(period.name, length: 47)
td= period.code
td
- if can? :read, Student
= link_to "Öğrenciler", students_admin_period_path(period)
span |
= link_to (t "general.show"), [:admin, period]
- if can? :update, Period
span |
@seyyah
seyyah / attachment.rb
Last active October 14, 2015 07:23 — forked from madwork/attachment.rb
class Attachment < ActiveRecord::Base
mount_uploader :attachment, AttachmentUploader
# Associations
belongs_to :attached_item, polymorphic: true
# Validations
validates_presence_of :attachment