Skip to content

Instantly share code, notes, and snippets.

@SomeKay
SomeKay / app_template.rb
Last active August 29, 2015 14:07 — forked from DamirSvrtan/app_template.rb
Added slim layout file and removed erb layout file
### Rails app generator template. Run it:
### rails new _app_name_ -m https://gist.githubusercontent.com/DamirSvrtan/28a28e50d639b9445bbc/raw/app_template.rb
bin_setup_file = <<-FILE
#!/bin/sh
bundle install
bundle exec rake db:setup
FILE
File.open('bin/setup', 'w'){|file| file.write(bin_setup_file)}
@SomeKay
SomeKay / package.json
Last active August 29, 2015 14:26
Initial package.json
{
"name": "sound_machine",
"version": "0.1.0",
"main": "./main.js",
"scripts": {
"start": "electron ."
}
}
'use strict';
var app = require('app');
var BrowserWindow = require('browser-window');
var mainWindow = null;
app.on('ready', function() {
mainWindow = new BrowserWindow({
height: 600,
@SomeKay
SomeKay / index.html
Created August 4, 2015 18:28
Hello, world index.html
<h1>Hello, world!</h1>
@SomeKay
SomeKay / index.html
Last active August 29, 2015 14:26
Basic sound machine layout
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sound Machine</title>
<link href="css/bootstrap.css" rel="stylesheet" type="text/css"/>
<link href="css/index.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="main" class="container-fluid">
@SomeKay
SomeKay / main.js
Created August 4, 2015 19:00
main.js with browser definitions for the sound machine
'use strict';
var app = require('app');
var BrowserWindow = require('browser-window');
var mainWindow = null;
app.on('ready', function() {
mainWindow = new BrowserWindow({
frame: false,
@SomeKay
SomeKay / index.css
Created August 4, 2015 19:09
Body and html part of index.css
html,
body {
...
-webkit-app-region: drag;
...
}
@SomeKay
SomeKay / index.css
Created August 4, 2015 19:10
Undraggable buttons in index.css
.button-sound {
...
-webkit-app-region: no-drag;
}
@SomeKay
SomeKay / index.js
Created August 4, 2015 21:14
index.js belonging to main window
'use strict';
var soundButtons = document.querySelectorAll('.button-sound');
for (var i = 0; i < soundButtons.length; i++) {
var soundButton = soundButtons[i];
var soundName = soundButton.attributes['data-sound'].value;
prepareButton(soundButton, soundName);
}
'use strict';
var nconf = require('nconf').file({file: getUserHome() + '/sound-machine-config.json'});
function saveSettings(settingKey, settingValue) {
nconf.set(settingKey, settingValue);
nconf.save();
}
function readSettings(settingKey) {