Skip to content

Instantly share code, notes, and snippets.

View Nick-t-go's full-sized avatar

Nick Toscano Nick-t-go

  • Brooklyn, NY
View GitHub Profile
@Nick-t-go
Nick-t-go / listItemSelectedExample.js
Created November 20, 2018 18:26
Material UI example for adjusting selected styling on list item.
const styles = theme => ({
selected: {
boxShadow: `18px 0px 0 #6699FF inset`,
backgroundColor: `rgba(102,153,255,0.2) !important`
}
});
render(){
return (
<div key={msg.id}>
@Nick-t-go
Nick-t-go / MuiTooltip_global_overide_example.js
Created November 9, 2018 20:23
Adjusting Font Size of Material-UI Tooltip Globally Example
const theme = createMuiTheme({
palette: {
primary: { main: '#FAFAFA' },
secondary: lightBlue
},
overrides: {
MuiTooltip: {
tooltip: { // Name of the component ⚛️ / style sheet
fontSize: 12, // Some CSS
},
@Nick-t-go
Nick-t-go / changeGroupToGroups.rb
Created April 6, 2018 19:34
Migrate Integer to array of integers Rails ActiveRecord
class ChangeGroupType < ActiveRecord::Migration[5.0]
def up
add_column :messages, :groups, :integer, array: true
Message.find_each do |msg|
msg.groups << msg.group
msg.save!
end
remove_column :messages, :group, :integer
end
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>FeatureLayer</title>
<link rel="stylesheet" href="https://js.arcgis.com/3.18/esri/css/esri.css">
<script src="https://js.arcgis.com/3.18/"></script>
import pyodbc
import json
SQLstatement = "SELECT * from %s %s" %(table, whereClause)
rows = cursor.execute(SQLstatement, params).fetchall()
columns = [column[0] for column in cursor.description]
results = []
for row in rows:
results.append(dict(zip(columns, row)))
print json.dumps(results)
if ($education->name != $input->name){
$education->name = $input->name
}elseif ($education->degree != $input->degree){
$education->degree = $input->degree
} elseif ($education->completion_date != $input->completion_date){
$education->completion_date = $input->completion_date
};
$education->save();
var bookmark = new Bookmarks({
map: map,
bookmarks: [],
editable: true
}, dojo.byId('bookmarks2'));
var measurement = new Measurement({
map: map
}, dom.byId("measurementDiv"));
measurement.startup();
<div id="mapDiv" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'" style="margin:5px;">
<div id="bookmarks-pane" data-dojo-type="dijit.TitlePane" data-dojo-props="title:'Bookmarks'">
<div id="bookmarks2"></div>
<button id="clear-storage">Remove Map Bookmarks</button>
</div>
<div style="position:absolute; right:20px; top:10px; z-Index:999;">
<div id="titlePane" data-dojo-type="dijit/TitlePane" data-dojo-props="title:'Measurement', closable:false, open:false">
<div id="measurementDiv"></div>
<span style="font-size:smaller;padding:5px 5px;">Press <b>CTRL</b> to enable snapping.</span>
</div>
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
}
if (window.StatusBar) {
// org.apache.cordova.statusbar required
editCredentials: function(uid, credItem, newData){
var ref = new Firebase('https://myapp.firebaseio.com/users/' + uid + '/credentials/');
var editCred = $firebaseObject(ref);
editCred[credItem] = newData;
editCred.$save(ref)
.then(function(data){
console.log(data)
})
.catch(function(error){
console.log(error)