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 } from 'react'; | |
function DialogContext({ initialState = false, children }) { | |
const [isOpen, setIsOpen] = useState(initialState); | |
return children( | |
isOpen, | |
() => setIsOpen(true), | |
() => setIsOpen(false) | |
) |
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 { Text } from 'react-native'; | |
export default () => <Text>OK</Text>; |
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 from 'react'; | |
import PropTypes from 'prop-types'; | |
import { withStyles } from '@material-ui/core/styles'; | |
import Input from '@material-ui/core/Input'; | |
import InputLabel from '@material-ui/core/InputLabel'; | |
import FormControl from '@material-ui/core/FormControl'; | |
import Paper from '@material-ui/core/Paper'; | |
import MenuItem from '@material-ui/core/MenuItem'; | |
let autocompleteService = null; |
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
#!/bin/bash | |
# Updating Ubunut | |
echo "updating ubunutu... please be patient" | |
apt-get update && apt-get upgrade -y | |
echo "installing required packages... please be patient" | |
apt-get install htop lib32gcc1 -y | |
# Create steam user if needed |
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
function Model(){} | |
// Converts a hash or each hash of an array into an instance of the calling class. | |
Model.fromObject = function(obj){ | |
if (obj && !$.isArray(obj)){ | |
return $.extend(new this(), obj); | |
} | |
var collection = []; | |
for(var index in obj){ collection.push(this.fromObject(obj[index])); } |
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 Scrubber | |
VALUE_PROVIDERS = { | |
"name" => Proc.new { Faker::Name.name }, | |
"email" => Proc.new { Faker::Internet.email }, | |
"ssn" => Proc.new { rand.to_s[2..10] } | |
} | |
def scrub(*classes) | |
classes.each do |klass| | |
klass.all.each { |model| fake(model) } |
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
select table_name, | |
round((data_length + index_length)/1024/1024/1024, 2) as `gb` | |
from information_schema.tables | |
where table_schema = "schema" | |
order by `gb` desc; |
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 ApplicationController < ActionController::Base | |
protect_from_forgery with: :exception | |
def devise_parameter_sanitizer | |
return super unless resource_class == User | |
Sanitizers::User.new(User, :user, params) | |
end | |
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
select.form-control + .chosen-container.chosen-container-single .chosen-single { | |
display: block; | |
width: 100%; | |
height: 34px; | |
padding: 6px 12px; | |
font-size: 14px; | |
line-height: 1.428571429; | |
color: #555; | |
vertical-align: middle; | |
background-color: #fff; |
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
var camelize = function(str) { | |
return str[0].toLowerCase() + str.replace(/-([a-z])/g, function(a, b) { return b.toUpperCase(); }).slice(1); | |
} | |
var pluginize = function(classname, context) { | |
var camelized = camelize(classname) | |
$.fn[camelized] = function(config){ | |
if (!this.length) return; | |
return this.each(function(){ | |
var $element = $(this) |
NewerOlder