This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
This file contains hidden or 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
| """ Give a) points in localcoordinate system b) a gps lat long of the origin of the local coordinate system, | |
| this script helps to convert XYZ to latlong. | |
| Beware that the transformation will be off by an yaw angle. This is because the local cordinate frame is may/or may not align with the East-North-Up frame. | |
| The way it works is XYZ --> ECEF --> geodedic (latlong) | |
| main reference is still the wiki https://en.wikipedia.org/wiki/Geographic_coordinate_conversion#From_ECEF_to_ENU. | |
| However the procedure to convert from ECEF to geodedic in wikip does not give accurate results. Instead the algorithm |
OlderNewer