Skip to content

Instantly share code, notes, and snippets.

@softwarespot
softwarespot / package.json
Last active September 13, 2015 17:06
Package.json configuration with gulp dependencies
{
"name" : "",
"version" : "",
"license": "MIT",
"repository": "",
"devDependencies": {
"del": "~1.2.1",
"gulp": "~3.9.0",
"gulp-babel": "^5.2.1",
"gulp-concat": "^2.6.0",
@softwarespot
softwarespot / Preferences.sublime-settings
Last active October 11, 2015 08:12
SublimeText user preferences
{
"theme": "Material-Theme-Darker.sublime-theme",
"color_scheme": "Packages/Material Theme/schemes/Material-Theme-Darker.tmTheme",
// Material Theme related settings
"overlay_scroll_bars": "disabled",
"line_padding_top": 3,
"line_padding_bottom": 3,
"font_options": [ "gray_antialias" ], // On retina Mac
"always_show_minimap_viewport": false,
"bold_folder_labels": true,
@softwarespot
softwarespot / JsFormat.sublime-settings
Created September 1, 2015 05:56
SublimeText JsFormat preferences
{
"brace_style":"collapse",
"break_chained_methods":false,
"end_with_newline":true,
"eval_code":false,
"indent_char":" ",
"indent_level":0,
"indent_size":4,
"indent_with_tabs":false,
"jslint_happy":false,
@softwarespot
softwarespot / es2015_demo.js
Created September 1, 2015 09:46
A simple demo of some of the new features of ES2015
// Example of using ES2015
// IIFE
(() => {
// Example of using rest params
function main(...args) {
// Cache length to increase performance
for (let i = 0, length = args.length; i < length; i++) {
// Display in the browser console
@softwarespot
softwarespot / 3_columns.css
Created September 3, 2015 14:40
Display three columns
/*HTML not included!*/
footer {
background: #c0392b;
overflow: hidden;
width: 100%;
}
footer div {
background: #e74c3c;
float: left;
@softwarespot
softwarespot / online_learning_resources.md
Last active September 3, 2018 16:03
JavaScript/PHP/C/C#/Java online learning resources

Online Learning Resources

The following document was updated on 2017/04/28

Disclaimer: I'm very much aware documents like this already exist and no doubt I will end up linking to them as well. But I wanted to have corner of my own where I could document links and short snippets that are useful to me.


JavaScript

@softwarespot
softwarespot / ES2015_class.js
Created September 7, 2015 04:30
ES2015 class
// Example of an ES2015 class
class Example {
constructor() {
this.property1 = 1;
this.property2 = 2;
}
someMethod() {
this.propery1 = this.propery2;
@softwarespot
softwarespot / ES2015_destructuring.js
Last active September 30, 2015 06:19
ES2015 destructuring
function destructuring( {weight, age, space = null }) {
// Instead of using something like opts.weight, now just use the property name in the function signature
console.log(weight);
console.log(age);
// Checking for null, standard ES5, as ?? isn't present in ES2015
console.log(space ? space : 'Space not set');
}
// Block scoped variable using let/const
@softwarespot
softwarespot / module+interface.js
Last active September 30, 2015 06:17
Creating a module with interface coupled together using ES2015
const myModule = ((interface) => {
// Implementing the interface
// This is like an interface, which doesn't pollute the main module with unrelated code
console.log(interface.init());
// Instantiate a new class that is attached to the interface
const _printClass = new interface.printClass();
return {
@softwarespot
softwarespot / ES2015_tagged_template_strings.js
Last active September 30, 2015 06:15
ES2015 tagged template strings
function valueToUpper(strings, ...values) {
// Set the values i.e. first and last name to upper-case
values[0] = values[0].toUpperCase();
values[1] = values[1].toUpperCase();
// Re-create the template
return `${strings[0]}${values[0]}${strings[1]}${values[1]}${strings[2]}`;
}
// Create first and last name variables