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 Shaders{ | |
static basic_vertex() { | |
return ` | |
void main() { | |
gl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0); | |
} | |
`; | |
} | |
static basic_fragment() { |
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
// Basic GET request using fetch API | |
async function GET() { | |
try{ | |
var url = "http://domain.com/route/api/endpoint"; | |
var get = await fetch(url); | |
var val = await get.text(); | |
console.log(val); | |
}catch(e){ |
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
// Fetches SQL table through ajax POST | |
// console.logs rows as JSON | |
// =============================== PHP (functions.php) | |
<?php | |
add_action( 'wp_ajax_clients', 'sql_get_clients' ); | |
add_action( 'wp_ajax_nopriv_clients', 'sql_get_clients' ); // postman (if user not logged in) | |
function sql_get_clients() { |
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
// Connect | |
function connect() { | |
var mongoose = require('mongoose'); | |
mongoose | |
.connect('mongodb://user:[email protected]:1234/project', { | |
useNewUrlParser: true | |
}) | |
.then(() => { | |
console.log('MongoDB Connected'); |
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
switch (uniform.type) | |
{ | |
case 'b': | |
case 'bool': | |
case 'boolean': | |
// single int value | |
case 'i': | |
case '1i' |
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
componentDidUpdate(prevProps, prevState) { | |
if (this.state !== prevState) { | |
// update redux state when Information.js state updates | |
this.props.updateNewEventInfo(this.state); | |
} | |
if (prevProps.eventcreation !== this.props.eventcreation) { | |
// redux prop is updated in component prop (slight delay between redux / prop updates) | |
} | |
} |
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
// Upload image using http POST & Google Cloud Storage API | |
var uploadUrl = 'https://www.googleapis.com/upload/storage/v1/b/wkndevents/o?uploadType=media&name=loremipsum.jpg'; // upload with direct HTTP call | |
var tmp_auth = 'Bearer tokenhere123'; // Get Bearer Access token here - https://developers.google.com/oauthplayground | |
// Enable access for Cloud Storage v1 & Cloud Storage JSON API | |
var fileinput = $('.file-upload-input')[0]; // <input type='file'> | |
var file = fileinput.files[0]; // just support 1st file for now | |
// post image into google cloud storage |
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
// get app bundle id | |
osascript -e 'id of app "Calendar"' | |
// update theme | com.apple.iCal is App's bundle identifier | |
defaults write com.apple.iCal NSRequiresAquaSystemAppearance -bool yes |
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
Options -MultiViews | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^ index.html [QSA,L] |
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 * as THREE from 'three'; | |
import { TrackballControls } from 'three/examples/jsm/controls/TrackballControls.js'; | |
class Scene extends React.Component { | |
constructor(props) { | |
super(props) | |
this.animate = this.animate.bind(this); |
OlderNewer