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 DatabaseReport | |
def entry_counts | |
tables = table_model_names.map do |model_name| | |
entity = model_name.constantize rescue nil | |
next if entity.nil? | |
[entity.to_s, entity.count] | |
end.compact | |
total = tables.reduce(0) do |acc, curr| | |
puts "#{curr[0]}: #{curr[1]}" | |
acc + curr[1] |
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
// this is an attempt at not adding redux just yet | |
import React, { createContext, useContext, useCallback, useEffect, useState } from 'react' | |
const Context = createContext({}) | |
const Provider = React.memo(({ value, children }) => <Context.Provider value={value}> | |
{children} | |
</Context.Provider>) |
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
import React, { useState } from 'react'; | |
import { View, ScrollView, RefreshControl, TouchableOpacity, StyleSheet } from 'react-native'; | |
import axios from 'axios' | |
import { dateAndTime } from '../../utils/dateFormatter'; | |
import { List, Text } from '../../components/ui'; | |
import i18n from 'i18n-js'; | |
import AddSession from "../../assets/images/addSession.svg" | |
import trackStore from '../sessions/trackStore' | |
import routes from '../../helpers/routes'; | |
import Colors from 'app/constants/Colors'; |
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
import { useState, useEffect }, React from 'react' | |
const categoriesURL = (id) => `your-url/categories` | |
export default Category () => { | |
const [categories, setCategories] = useState([]) | |
useEffect(() => { | |
fetch(categoriesURL).then(res => res.json()).then(data => setCategories(data)) | |
}, []) | |
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
// how to use: | |
// on embed: https://share.getcloudapp.com/d5ub5A0K | |
// on playlist | |
(function(document){ | |
let { wrapper, rowClass, nameClass, artistClass } = getSelectors(); | |
var container = document.createElement('textarea'); | |
document.body.appendChild(container) | |
var results = [...wrapper.querySelectorAll(rowClass)].map(s => { |
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
import requestPermissions from './requestPermissions' | |
requestPermission(pickFromCamera, { | |
permissionNames: ['CAMERA', 'CAMERA_ROLL'], | |
alertTitle: '📷Camera📸', | |
alertBody: 'Use your camera now.', | |
}) | |
// Only request every n times this is run |
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
[ | |
{ | |
"artist":"Drowning the Call", | |
"song":"Mirrorring" | |
}, | |
{ | |
"artist":"Replicant", | |
"song":"Sync24" | |
}, | |
{ |
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
[ | |
{ | |
"timestamp":1519267261, | |
"event":"processed", | |
"sg_message_id":"14c5d75ce93.dfd.64b469.filter0001.16648.5515E0B88.0", | |
"smtp-id":"<14c5d75ce93.dfd.64b469@ismtpd-555>", | |
"sg_event_id":"2FeCcG5VRWpck6mKqRgnDg==", | |
"category":"cat facts", | |
"email":"[email protected]" | |
}, |
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
<?php | |
function my_module_ctools_plugin_directory($module, $plugin) { | |
if ($module == 'ctools' && !empty($plugin)) { | |
return "plugins/$plugin"; | |
} | |
} |
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
let $back; | |
const BACKGROUND_ID = '#background', SCROLL_SELECTOR = 'main'; | |
//hard-coded backgoround image size to start parallax asap | |
let sizes = { | |
width: 1678, height: 2481 | |
}; | |
$(document).on('turbolinks:load', () => { | |
$(scrollSelector).on('scroll', handleParallax); | |
setSize(); |
NewerOlder