Skip to content

Instantly share code, notes, and snippets.

dminuoso

Block or report user

Report or block dminuoso

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:3cb4b013f77188c2c4220d339b025377
self.num_reserved = order_data.match(/\"ordered\"\:.*\n/)[0].match(/\d+/)[0]
View application.html.haml
- if Rails.env.production?
%script
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-15209814-7', 'auto');
ga('send', 'pageview');
%script
View app_helper.rb
def capture_proc
proc { |*args| capture_haml { yield *args } }
end
View foo.js
// The call with a callback to self
try {
winfo = windarea.getWindInfo2(LonLat.lat, LonLat.lon, this.time, wante, wpost);
//this.drawWind(ctx, p.x, p.y, winfo);
var MI = GribMgr.WindAtPointInTime(new Date(this.time*1000),LonLat.lat, LonLat.lon,
function(){this.drawWindArea(p, poslimit, windarea, ctx)})
if (MI)
{
winfo = new Wind(MI.Speed, MI.Heading);
this.drawWind(ctx, p.x, p.y, winfo);
View searchSaga.js
import { put, call, race, fork, take, cancel, select, delay, cancelled } from 'redux-saga/effects';
import { makeSelectMask } from './selectors';
import { createRequestCreators } from './actions';
function* fetchEntity(entity, apiFn, opts, id, url) {
try {
yield put(entity.request(id));
const { response, error } = yield call(apiFn, url || id);
if (response) {
yield put(entity.success(id, response));
View foo.js
export const searchWatchStart = (searchConstants, selectSearch, apiFn, handleError) => {
const searchCreators = createRequestCreators(searchConstants.FETCH_STATUS);
const loadResults = fetchEntity.bind(null, searchCreators, apiFn, { handleError });
const selectMask = makeSelectMask(selectSearch);
return function* () { // eslint-disable-line func-names
let lastTask;
for (;;) {
const { wait } = yield take(searchConstants.START_SEARCH);
View foo.rb
[1] pry(main)> ObjectSpace.each_object.inject([]) { |a, e| a << e if (e.class == Class && !e.ancestors.include?(Object)); a }
DEPRECATION WARNING: MissingSourceFile is deprecated! Use LoadError instead. (called from block in <main> at (pry):1)
=> [JbuilderTemplate,
ActiveRecord::Type::Serialized,
#<Class:0x007fd0789aac18>,
ActiveRecord::Type::Time::Value,
#<Class:0x007fd078a100e0>,
Concurrent::SynchronizedDelegator,
ActionDispatch::Response::Header,
Sprockets::LegacyTiltProcessor,
View gist:3e313ec5e3e7fcec08fd6c9fe5536251
def process_defn
if false
case 42
when s {} then
when 42 then
return
end
end
return
end
View test.rb
if false
foo = 1
end
# is foo defined?
View random.rb
[0,1,2,3,4,5,6,7,8,9].select do |x|
x if x%2==0
end
You can’t perform that action at this time.