Skip to content

Instantly share code, notes, and snippets.

View santosoide's full-sized avatar
💭
I may be slow to respond.

Edi Santoso santosoide

💭
I may be slow to respond.
View GitHub Profile
// This is an example of how to fetch external data in response to updated props,
// If you are using an async mechanism that does not support cancellation (e.g. a Promise).
class ExampleComponent extends React.Component {
_currentId = null;
state = {
externalData: null
};
@santosoide
santosoide / gmaps_3.html
Created March 20, 2018 14:27 — forked from opnchaudhary/gmaps_3.html
Get latitude and longitude from google maps
<!doctyp html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Get Latitude and Longitude</title>
<script src="http://maps.google.com/maps/api/js?libraries=places&region=uk&language=en&sensor=true"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
</head>
<body>
@santosoide
santosoide / splice-object-array.js
Created December 22, 2017 06:55 — forked from scottopolis/splice-object-array.js
Remove object from array of objects in Javascript
// source: http://stackoverflow.com/questions/16491758/remove-objects-from-array-by-object-property
// we have an array of objects, we want to remove one object using only the id property
var apps = [{id:34,name:'My App',another:'thing'},{id:37,name:'My New App',another:'things'}];
// get index of object with id:37
var removeIndex = apps.map(function(item) { return item.id; }).indexOf(37);
// remove object
apps.splice(removeIndex, 1);
@santosoide
santosoide / css-media-queries-cheat-sheet.css
Created October 20, 2017 01:23 — forked from bartholomej/css-media-queries-cheat-sheet.css
CSS Media Query Cheat Sheet (with Foundation)
/*------------------------------------------
Responsive Grid Media Queries - 1280, 1024, 768, 480
1280-1024 - desktop (default grid)
1024-768 - tablet landscape
768-480 - tablet
480-less - phone landscape & smaller
--------------------------------------------*/
@media all and (min-width: 1024px) and (max-width: 1280px) { }
@media all and (min-width: 768px) and (max-width: 1024px) { }
@santosoide
santosoide / iterm2-solarized.md
Created September 28, 2017 08:31 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

<!doctype html>
<html>
<head>
<title>Hello Marko</title>
</head>
<body>
<h1>My favorite colors</h1>
<ul.colors>
<li for(color in input.colors)>
${color}
<!doctype html>
html
head
title -- Hello Marko
body
h1 -- My favorite colors
ul.colors
li for(color in input.colors)
-- ${color}
class {
onCreate() {
this.state = { count:0 };
}
increment() {
this.state.count++;
}
}
style {
@santosoide
santosoide / laravel_nginx.md
Created April 10, 2017 11:11 — forked from folivares/laravel_nginx.md
Nginx configuration for Laravel 5.1

Nginx Server Blocks configuration to run more than one Laravel 5.1 web-app off of a single Linux server

Prerequisites

  • PHP package: php5-fpm php5-mcrypt php5-mysql
  • Laravel 5.1
  • Nginx 1.8

Default Server Block

@santosoide
santosoide / gist:184b79e7b6d4eb83c4ecebd6a52c14e5
Created March 13, 2017 03:19 — forked from tamoyal/gist:10441108
Create super user and database user in Mongo 2.6
# Create your superuser
$ mongo
> use admin
> db.createUser({user:"someadmin",pwd:"secret", roles:[{role:"root",db:"admin"}]})
> exit
# Alias for convenience (optional and at your own risk)
$ echo 'alias mongo="mongo --port 27017 -u someadmin -p secret --authenticationDatabase admin"' >> ~/.bash_profile
$ source ~/.bash_profile