Skip to content

Instantly share code, notes, and snippets.

View wayanjimmy's full-sized avatar
🏠
Working from home

Wayan jimmy wayanjimmy

🏠
Working from home
View GitHub Profile
#/bin/bash
#-- Script to automate https://help.github.com/articles/why-is-git-always-asking-for-my-password
REPO_URL=`git remote -v | grep -m1 '^origin' | sed -Ene's#.*(https://[^[:space:]]*).*#\1#p'`
if [ -z "$REPO_URL" ]; then
echo "-- ERROR: Could not identify Repo url."
echo " It is possible this repo is already using SSH instead of HTTPS."
exit
fi
@wayanjimmy
wayanjimmy / fix_mac_sublime_home_end
Last active August 29, 2015 14:11
Fix Mac Sublime text Home End
[
{ "keys": ["home"], "command": "move_to", "args": {"to": "bol"} },
{ "keys": ["end"], "command": "move_to", "args": {"to": "eol"} },
{ "keys": ["shift+end"], "command": "move_to", "args": {"to": "eol", "extend": true} },
{ "keys": ["shift+home"], "command": "move_to", "args": {"to": "bol", "extend": true } }
]
@wayanjimmy
wayanjimmy / create unity launcher
Created December 12, 2014 18:04
create ubuntu unity launcher
sudo mv /from_where_it_is to /opt/firefox_dev/
sudo chown -R $(whoami):$(whoami) /opt/firefox_dev/
gnome-desktop-item-edit ~/.local/share/applications --create-new
@wayanjimmy
wayanjimmy / tinker
Created December 10, 2014 06:25
artisan tinker
php artisan tinker --env=local
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="red_50">#fde0dc</color>
<color name="red_100">#f9bdbb</color>
<color name="red_200">#f69988</color>
<color name="red_300">#f36c60</color>
<color name="red_400">#e84e40</color>
<color name="red_500">#e51c23</color>
<color name="red_600">#dd191d</color>
<color name="red_700">#d01716</color>
@wayanjimmy
wayanjimmy / jquery_ajax_file_upload.js
Created November 14, 2014 05:05
jquery ajax fileupload
$('#file').change(function(){
var formData = new FormData();
var current = $(this);
formData.append("file", $(this)[0].files[0]);
// additional data
formData.append("id", "1");
var promise = $.ajax({
url: "url",
type: 'post',
@wayanjimmy
wayanjimmy / CorsMiddleware.php
Created November 13, 2014 16:49
Slim Middleware CORS (OPTION request intercept)
class CorsMiddleware extends \Slim\Middleware
{
public function call()
{
// Get reference to application
$app = $this->app;
if(!$app->request->isOptions()) {
// Run inner middleware and application
$this->next->call();
@wayanjimmy
wayanjimmy / index.html
Created November 10, 2014 10:13
A Pen by Captain Anonymous.
<html>
<head>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
</head>
<body>
<ul class="images-list list-unstyled">
<li>
<span class="header">
@wayanjimmy
wayanjimmy / laravel_route_group_prefix.php
Created November 5, 2014 01:36
laravel route grouping with prefix
<?php
Route::group(array('prefix' => 'api/v1'), function(){
// routing here
});
@wayanjimmy
wayanjimmy / php_ssh2_git_pull.php
Created October 29, 2014 07:05
Otomatisasi git pull dengan PHP ssh2_connect
<?php
if (!function_exists("ssh2_connect")) die("function ssh2_connect doesn't exist");
// log in at server1.example.com on port 22
if(!($con = ssh2_connect("host", "port"))){
echo "fail: unable to establish connection\n";
} else {
// try to authenticate with username root, password secretpassword
if(!ssh2_auth_password($con, "username", "password")) {
echo "fail: unable to authenticate\n";