# supports only notice and alert by default
# the rest has to go into flash hash
redirect_to :index, notice: "success"
redirect_to :new, notice: "errors"
redirect_to :new, flash: { success: "yeah" }
flash[:info] = "updated"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
directory = Dir.getwd.split("/").pop | |
command = "tar czf ../#{directory}-#{Time.now.strftime("%Y-%m-%d-%H%M%S")}.tar.gz ." | |
blacklist = %W[usr Users #{ENV["USER"]} projects] | |
blacklist << nil | |
if blacklist.include? directory | |
puts "Forbidden directory" | |
puts "Command if you want to run it manually: #{command}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// jQuery-like syntactic sugar. Only queries for one element. Does not loop over multiple like jQuery | |
function $(query) { | |
if (typeof query === 'undefined') throw 'No query provided to $'; | |
var el; | |
if (typeof query.nodeType === 'string') { | |
el = query; | |
} else if (typeof query === 'string' && query[0] === '<') { | |
const container = document.createElement('div'); | |
container.innerHTML = query; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NSScanner+Swift.swift | |
// A set of Swift-idiomatic methods for NSScanner | |
// | |
// (c) 2015 Nate Cook, licensed under the MIT license | |
import Foundation | |
extension Scanner { | |
// MARK: Strings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NSScanner+Swift.swift | |
// A set of Swift-idiomatic methods for NSScanner | |
// | |
// (c) 2015 Nate Cook, licensed under the MIT license | |
import Foundation | |
extension Scanner { | |
// MARK: Strings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open3' | |
#basic shell command | |
def run_command(current_command) | |
Open3.popen2e(current_command) {|stdin, stdout, wait_thr| | |
pid = wait_thr.pid # pid of the started process. | |
puts pid | |
stdout.each do |line| log line end |
Install emacs clone spacemacs into the emacs dir for all the configs
git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d
install sourcekitten and sourcekittendaemon
https://github.com/terhechte/SourceKittenDaemon
run emacs once and select vim as the editing style then press spc f e d
to open up the dotfile