This file contains hidden or 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
#!/bin/bash | |
# install js2coffee first with `npm install js2coffee` | |
find ./app/assets/javascripts -iname "*.js" | \ | |
while read I; | |
do | |
`js2coffee ${I} > ${I}.coffee` | |
echo "$I has been coffefied" | |
`rm ${I}` | |
done |
This file contains hidden or 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
class ApplicationController < ActionController::Base | |
#... | |
after_filter :flash_to_headers | |
#... | |
protected | |
def flash_to_headers |
This file contains hidden or 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
#!/bin/bash | |
# (re)Create PostgreSQL databases from a bunch of .sql.gz dumps | |
DBHOST=localhost | |
DBUSER=root | |
for f in *.sql.gz | |
do | |
echo "Unpacking $f ..." |
This file contains hidden or 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
$(document).ready -> | |
myApp.loader = new myApp.views.LoadingIndicator() | |
$(document).ajaxSend -> myApp.loader.start() | |
$(document).ajaxComplete -> myApp.loader.finish() | |
$(document).ajaxError -> myApp.loader.finish() |
This file contains hidden or 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
makeReplySubject = (sourceSubject) -> | |
match = sourceSubject.match(/^Re\s*(\[\s*(\d)+\s*\])?:\s*(.+)$/i) | |
return "Re: #{sourceSubject}" unless match? | |
if match[2]? | |
replyNumber = parseInt(match[2]) | |
"Re [#{replyNumber + 1}]: #{match[3]}" | |
else | |
"Re [2]: #{match[3]}" |
This file contains hidden or 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
// Выполнить строку в консоли инструментов разработчика | |
//В BBCode | |
copy($('#bigGallery a').map(function(i){ return '[url='+$(this).attr('href')+'][img]'+$(this).attr('rel')+'[/img][/url]'; }).get().join("\n"));alert('Photos BBCode copied to clipboard'); | |
// Список фоток для aria2 input file | |
copy($('#bigGallery a').map(function(i){ return $(this).attr('href')+"\n out="+i+'.jpg'; }).get().join("\n")); |
This file contains hidden or 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
# ImageMagick helper to import custom fonts from Ruby instead of imagick_type_gen python script | |
# Designed for OSX/Heroku | |
# Usage: | |
# desc 'Init custom fonts' | |
# task fonts: :environment do | |
# ImagemagickFontTool.export_type_xml(nil, '/app') # For Heroku | |
# if Rails.env.development? | |
# home_type_config = File.expand_path '~/.magick/myapp-type.xml' # Need to register this manually in ~/.magick/type.xml | |
# ImagemagickFontTool.export_type_xml home_type_config |
This file contains hidden or 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
import * as _ from 'lodash'; | |
import { Component, DoCheck, Input, IterableDiffer, IterableDiffers, OnInit } from '@angular/core'; | |
import { Trend } from '../../../models/trend-trade/trend-trade'; | |
@Component({ | |
template: ` | |
<tr> | |
<td></td> | |
<td colspan="2">Total:</td> | |
<td>{{ totalValue }}</td> |
This file contains hidden or 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
MyRailsApp::Application.routes.draw do | |
get :have_fun, :to => proc { |env| | |
result = {some: 'data'} | |
res = result.to_json | |
[200, {"Content-Type" => 'application/json'}, [res]] | |
} | |
end |
This file contains hidden or 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
# ~/.bashrc: executed by bash(1) for non-login shells. | |
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
# for examples | |
# If not running interactively, don't do anything | |
case $- in | |
*i*) ;; | |
*) return;; | |
esac |
OlderNewer