Skip to content

Instantly share code, notes, and snippets.

View placidrod's full-sized avatar

Placid Rodrigues placidrod

  • Movio
  • Auckland, New Zealand
View GitHub Profile
@placidrod
placidrod / Intellij Spark Scala SBT Run Error.txt
Created November 16, 2017 13:27
Intellij Spark Scala SBT Run Error
"C:\Program Files\Java\jdk1.8.0_112\bin\java" -Xms512M -Xmx1024M -Xss1M -XX:+CMSClassUnloadingEnabled "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.2.5\lib\idea_rt.jar=54551:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.2.5\bin" -Dfile.encoding=windows-1252 -classpath C:\Users\ASUS\.IdeaIC2017.2\config\plugins\Scala\launcher\sbt-launch.jar xsbt.boot.Boot ~run
[info] Loading settings from plugins.sbt ...
[info] Loading project definition from C:\Users\ASUS\IdeaProjects\SbtIntellSpark2\project
[info] Loading settings from build.sbt ...
[info] Set current project to SbtIntellSpark2 (in build file:/C:/Users/ASUS/IdeaProjects/SbtIntellSpark2/)
[info] Running example.Main
[debug] Waiting for threads to exit or System.exit to be called.
[debug] Classpath:
[debug] C:\Users\ASUS\AppData\Local\Temp\sbt_f91e094a\job-1\target\be6b89a5\sbtintellspark2_2.11-0.1.jar
[debug] C:\Users\ASUS\AppData\Local\Temp\sbt_f91e094a\target\bf5534e6\scala-library-2.11.12.jar
@placidrod
placidrod / intellig_shortcuts.txt
Created October 12, 2017 16:57
Intellig IDE Shortcuts Mac
Create new class, worksheet etc:
Ctrl + Option + N
Move line up
Command + Shift + Up Arrow
Copy line down
Command + D
Multiple word selection
Ctrl + G
Multiple word selection UNDO
Ctrl + Shift + G
@placidrod
placidrod / vk-function.php
Created December 18, 2016 17:14
VK Functions
/* Customize Single Product Page
-------------------------------------------*/
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 );
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );
// remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_output_product_data_tabs', 20 );
/* Change url of Back to Shop Button */
@placidrod
placidrod / sublime-text-3-open-in-command-line.txt
Created June 27, 2016 07:39
Sublime Text 3 - Open in Command Line (Windows)
You can open sublime text from command line with subl.exe and subl. The second one has a problem. If sublime text is not open already,
when you open sublime text with subl, the command prompt will wait until sublime text is closed. So, you cannot do anything else in
terminal, unless you open another terminal. This is useful in some cases. But sometimes its a pain.
Method 1: Open with subl.exe
1. Go to Control Panel > Advanced System Settings -> Advanced -> Environment Variables
2. Create a new system variable called SUBLIME that will point to the folder of your Sublime installation.
Variable Name: SUBLIME
Variable Value: C:\Program Files\Sublime Text 3
@placidrod
placidrod / AppServiceProvider.php
Created May 28, 2016 13:48
Laravel Create Unique Slug in AppServiceProvider
public function boot()
{
Post::saving(function ($post) {
$title = $post->title;
$proposed_slug = strtolower(str_replace(' ', '-', $title));
$existing_slug = Post::where('slug', $proposed_slug)->where('id', '<>', $post->id)->first();
if(! $existing_slug) {
$post->slug = $proposed_slug;
@placidrod
placidrod / Laravel Restful jQuery Ajax Delete Record.php
Created April 2, 2016 06:29
Laravel Restful jQuery Ajax Delete Record
// route: route must go through 'web' middleware
Route::group(['middleware' => ['web']], function () {
Route::resource('post', 'PostsController');
});
// view: href link with token
<a href="{{ action('PostsController@destroy', ['id'=>$post->id]) }}"
data-token="{{ csrf_token() }}"
data-id="{{ $post->id }}"
class="delete-post-link"
@placidrod
placidrod / Default (Windows).sublime-mousemap
Last active July 20, 2016 08:17
Sublime Text - Click to Go to Definition (Save the file in Sublime Text 3 > Packages > User)
[
{
"button": "button1",
"count": 1,
"modifiers": ["alt"],
"press_command": "drag_select",
"command": "goto_definition"
},
{
"button": "button2",
@placidrod
placidrod / mongodb1.js
Last active June 30, 2018 20:44
MongoDb
// Select or Create a Database
use MyDatabase
// Create a Collection and insert document
db.myCollection.insert({
"Name": "Placid",
"Age": 37,
"Hobbies": ["Travelling", "Movies"],
"myObjects": {
"property1" : "value1",
JavaScript resources, all free online. They're ordered in diffuculty from top to bottom.
http://jsforcats.com/
https://www.youtube.com/playlist?list=PLeL6uTxQ-uX_5BpOb2FDNgG6SxjCs59Kv
https://www.youtube.com/watch?v=hQVTIJBZook
https://www.khanacademy.org/computing/computer-science/algorithms
http://speakingjs.com/es5/index.html
http://eloquentjavascript.net/index.html
http://superherojs.com/
https://www.youtube.com/watch?v=8aGhZQkoFbQ
@placidrod
placidrod / gist:decf4140039d5dd0167e
Last active August 29, 2015 14:24
FCC Bonfire: Convert HTML Entities
function convert(str) {
var ent = {
'&' : '&amp;',
'<' : '&lt;',
'>' : '&gt;',
'\"': '&quot;',
"\'": '&apos;'
};
var re = new RegExp(Object.keys(ent).join('|'), "g");