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
# Beginning Rubyists: simply run >> ruby hex-convertions.rb to see examples | |
# or use irb to build the code on the fly | |
# you can convert HEX to DEC using the method .to_i(base), | |
# which converts a string to a decimal number from the specified base number | |
puts "00".to_i(16) | |
puts "FF".to_i(16) |
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 FacebookCommentNotifer | |
def initialize(comment) | |
@comment = comment | |
end | |
def save | |
@comment.save && post_to_wall | |
end | |
private |
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
# encoding: utf-8 | |
class AlbumForm < BaseForm | |
has_many :songs, class_name: 'SongForm' | |
validates :songs, form_collection: true | |
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
class User < ActiveRecord::Base; end; | |
class Post < ActiveRecord::Base; end; | |
class Comment < ActiveRecord::Base; end; | |
class AuthorSerializer < ActiveModel::Serializer | |
attributes :id, :name :created_at, :updated_at | |
end | |
class PostSerializer < ActiveModel::Serializer | |
attributes :id, :body :created_at, :updated_at |
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
/** | |
* Created by Karlen on 13-Aug-14. | |
*/ | |
var imageContext = document.getElementById('imageCanvas').getContext('2d'), | |
lutContext = document.getElementById('lutCanvas').getContext('2d'); | |
function applyLUT(image, lut) { | |
var imageData, lutData, iData, lData; |
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
// dependencies ---------------------------------------------------------------------- | |
import Reflux from 'reflux'; | |
import Actions from '../actions/Actions'; | |
import request from 'superagent'; | |
import config from '../config'; | |
let UserStore = Reflux.createStore({ | |
// store setup ----------------------------------------------------------------------- |
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 MyJob < ActiveJob::Base | |
queue_as :urgent | |
rescue_from(NoResultsError) do | |
retry_job wait: 5.minutes, queue: :default | |
end | |
def perform(*args) | |
MyService.call(*args) | |
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
// | |
// UIImage+Resize.swift | |
// Port of UIImage+Resize.m | |
// from http://vocaro.com/trevor/blog/2009/10/12/resize-a-uiimage-the-right-way/ | |
// | |
import Foundation | |
import UIKit | |
extension UIImage { |
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
//RCTListViewManger.h | |
#import <UIKit/UIKit.h> | |
@interface RCTNativeListView : UIView | |
@property (nonatomic) NSArray * colors; | |
@end | |
-------------------------------------------------------------------------------- | |
//RCTListViewManger.m |
OlderNewer