Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Edi Santoso cyberid41

🏠
Working from home
Block or report user

Report or block cyberid41

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View updating-external-data-when-props-changes-using-promises.js
// 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
};
@cyberid41
cyberid41 / gmaps_3.html
Created Mar 20, 2018 — forked from opnchaudhary/gmaps_3.html
Get latitude and longitude from google maps
View gmaps_3.html
<!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>
@cyberid41
cyberid41 / splice-object-array.js
Created Dec 22, 2017 — forked from scottopolis/splice-object-array.js
Remove object from array of objects in Javascript
View splice-object-array.js
// 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);
@cyberid41
cyberid41 / css-media-queries-cheat-sheet.css
Created Oct 20, 2017 — forked from bartholomej/css-media-queries-cheat-sheet.css
CSS Media Query Cheat Sheet (with Foundation)
View css-media-queries-cheat-sheet.css
/*------------------------------------------
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) { }
@cyberid41
cyberid41 / iterm2-solarized.md
Created Sep 28, 2017 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)
View iterm2-solarized.md

Default

Default

Powerlevel9k

Powerlevel9k

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

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

@cyberid41
cyberid41 / gist:184b79e7b6d4eb83c4ecebd6a52c14e5
Created Mar 13, 2017 — forked from tamoyal/gist:10441108
Create super user and database user in Mongo 2.6
View gist:184b79e7b6d4eb83c4ecebd6a52c14e5
# 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
You can’t perform that action at this time.