Skip to content

Instantly share code, notes, and snippets.

error = "<%= escape_javascript flash[:error] %>"
unless error
$('tr#<%= dom_id(@category) %>').fadeOut()
else
$('#content').prepend("<%= escape_javascript render(partial: 'flashes') %>")
@Darkside73
Darkside73 / gist:05560a085522f0cfbe15
Created July 24, 2014 09:21
Create rails application with rvm gemset
#! /bin/sh
source "$HOME/.rvm/scripts/rvm"
app_name=$1
rvm default
current_ruby=`rvm current`
echo "Creating gemset ${app_name}..."
rvm gemset create $app_name
@Darkside73
Darkside73 / chpwd_profiles.plugin.zsh
Created July 24, 2014 12:39
Oh-my-zsh: alias rails, rake commands to generated spring binstubs on entering project's directory
# put this file to $HOME/.oh-my-zsh/custom/plugins/chpwd_profiles
# and add plugin name to .zshrc: plugins=(... chpwd_profiles)
function chpwd_profiles() {
local -x profile
zstyle -s ":chpwd:profiles:${PWD}" profile profile || profile='default'
if (( ${+functions[chpwd_profile_$profile]} )) ; then
chpwd_profile_${profile}
fi
@Darkside73
Darkside73 / gist:1f1a34e13d585fddeb20
Created March 18, 2015 09:41
Ruby mixin example with configurable methods
require 'active_support'
module Connectable
extend ActiveSupport::Concern
def connect
puts "connecting with #{self.class.params}"
end
class_methods do
<?php
class User extends UserAbstract {
public $old_password;
public $auth_hash;
public $usernameOnForum;
@Darkside73
Darkside73 / webpack.server.js
Created January 14, 2016 08:22
Webpack dev server with hot reload
const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const config = require('../webpack.config');
const hotWebpackPort = process.env.HOT_WEBPACK_PORT || 3500;
config.output.publicPath = `https://localhost:${hotWebpackPort}/assets/`;
['entry1', 'entry2'].forEach(entryName => {
config.entry[entryName].push(
'webpack-dev-server/client?https://localhost:' + hotWebpackPort,
'webpack/hot/only-dev-server'

Ubuntu 15.10 npm 3.5.3 node 4.2.6

test-sourcemaps@ /tmp/my-project
├─┬ babel-core@6.4.5
│ ├─┬ babel-code-frame@6.3.13
│ │ ├── js-tokens@1.0.2
│ │ ├─┬ line-numbers@0.2.0
[user]
name = darkside
email = andrey.garbuz@gmail.com
[color]
diff = auto
status = auto
branch = auto
[color "branch"]
current = green
local = yellow
@Darkside73
Darkside73 / gist:3905c264146632f951998c29b4e1e0fa
Created November 9, 2016 14:40
Sublime Text 3 user settings
{
"caret_style": "phase",
"color_scheme": "Packages/RailsCasts Colour Scheme/RailsCastsColorScheme.tmTheme",
"default_line_ending": "unix",
"detect_slow_plugins": false,
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
".tags*",
"*.pyc",
@Darkside73
Darkside73 / component.vue
Created December 15, 2016 14:56
Vue UI notifications
<template>
<transition name="fade" enter-active-class="fadeInDown" leave-active-class="fadeOutDown">
<div :class="cssClass" class="ui animated message">
<i @click="triggerClose(notification)" class="close icon"></i>
<div v-if="notification.title" class="header">{{notification.title}}</div>
<p>{{notification.text}}</p>
</div>
</transition>
</template>