Skip to content

Instantly share code, notes, and snippets.

@jamesmosier
jamesmosier / index.html
Created November 21, 2012 15:40
A CodePen by Erick Arbe. The Backside Menu Flip - A responsive navigation pattern whereas the nav (under 768px) is located on the "backside" of the page content.
<div id="page_container">
<div id="main_content">
<div class="front face">
<!-- ALL THE SITE CONTENT GOES HERE -->
<header class="clearfix">
// Mobile First
@media screen and (min-width: 321px) { // iPhone landscape
}
@media screen and (min-width: 481px) { // iPad portrait
}
@jamesmosier
jamesmosier / Null-Empty-Int
Created October 28, 2014 19:16
Check for null or empty int
//To check for null int (if int is marked as nullable)
if (request.Tickets.Any(x => x.EventId == default(int?))) {}
//Otherwise to just check for "no" eventId which is zero
if (request.Tickets.Any(x => x.EventId == 0)) {}
@jamesmosier
jamesmosier / Angular-Directive-jQuery-Plugin
Created October 28, 2014 19:22
AngularJS Directive for jQuery plugin that fires on partial load
//To use this: <div tfinder-map="{queryLimit: 3}"></div>
angular.module('myApp.directives', []).
directive('tfinderMap', function($timeout) {
return {
restrict: 'A',
link: function(scope, element, attrs) {
attrs.$observe("tfinderMap", function(value) {
if (value) {
@jamesmosier
jamesmosier / README.md
Last active August 29, 2015 14:19 — forked from erwaller/README.md
@jamesmosier
jamesmosier / babel.js
Last active February 18, 2016 02:36
babel js grunt task
//npm install --save-dev grunt-babel babel-preset-es2015
'use strict';
module.exports = {
options: {
sourceMap: true,
presets: ['es2015']
},
dist: {
files: [{
@jamesmosier
jamesmosier / webpack.config.js
Created January 11, 2017 20:30
webpack config
'use strict';
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const path = require('path');
const resolve = path.resolve;
const rootDir = resolve(__dirname);
const dist = resolve(rootDir, 'appname/secured_assets');
const assetIndex = resolve(rootDir, 'src/app');
@jamesmosier
jamesmosier / android-google-play-api-subscriptions.js
Created March 27, 2018 15:53
Example, using Node, on how to get user subscriptions using the Google Play Developer API (with androidpublisher role)
const { google } = require("googleapis");
const publisher = google.androidpublisher("v2");
const OAuth2 = google.auth.OAuth2();
const SERVICE_ACCOUNT_EMAIL = "some_google_acccount@gmail.com";
const SERVICE_ACCOUNT_KEY_FILE = require("./path/to/credentials.json");
const jwtClient = new google.auth.JWT(
SERVICE_ACCOUNT_KEY_FILE.client_email,
@jamesmosier
jamesmosier / locations.json
Created July 26, 2018 15:48
Locations test with duplicate coords
{
"count": 10785236,
"photos": [{
"photo_id": 555,
"photo_title": "222 Atardecer en Embalse",
"photo_url": "http://www.panoramio.com/photo/27932",
"photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/27932.jpg",
"longitude": -64.404945,
"latitude": -32.202924,
"width": 500,
@jamesmosier
jamesmosier / PriceSlider.jsx
Last active March 20, 2019 13:52
Slider using useImperativeHandle hook
import React, { useRef } from 'react';
import Slider from './Slider';
import useSlider from './useSlider';
const MIN_VALUE = 0;
const MAX_VALUE = 500;
function PriceSlider() {
const sliderRef = useRef(null);