Skip to content

Instantly share code, notes, and snippets.

View SergXIIIth's full-sized avatar

Sergey Makridenkov SergXIIIth

View GitHub Profile
@SergXIIIth
SergXIIIth / Rakefile
Last active December 20, 2015 22:59
Simple solution, a rake task for use CoffeeScript in Jasmine. Supported: 1. write code in CoffeeScript 2. write spec in CoffeeScript. Could be used in any Ruby application (Sinatra, Rails ...)
require 'bundler/gem_tasks'
require 'jasmine'
require 'coffee-script'
require 'fileutils'
load 'jasmine/tasks/jasmine.rake'
task 'test' do
pattern = '{**/*.rb,**/*.slim,**/*.coffee}'
@SergXIIIth
SergXIIIth / vk_download.js
Created May 13, 2013 15:13
Download music from vk.com. 1. Run vk_download.js inside your music 2. Save result json to file "tracks.json" 3. Run "ruby vk_download.rb" Music we be in "./tracks"
function async_init() {
var element, type, src;
var parent = document.getElementsByTagName('body');
var cdn = new Array;
cdn[0] = '//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js';
for (var i in cdn) {
element = document.createElement('script');
@SergXIIIth
SergXIIIth / vk_download.js
Created May 13, 2013 15:13
Download music from vk.com. 1. Run vk_download.js inside your music 2. Save result json to file "tracks.json" 3. Run "ruby vk_download.rb" Music will be in "./tracks"
function async_init() {
var element, type, src;
var parent = document.getElementsByTagName('body');
var cdn = new Array;
cdn[0] = '//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js';
for (var i in cdn) {
element = document.createElement('script');
@SergXIIIth
SergXIIIth / gist:4977359
Created February 18, 2013 13:24
Encryption Ruby On Rails
secret = Digest::SHA1.hexdigest("yourpass")
a = ActiveSupport::MessageEncryptor.new(secret)
b = a.encrypt("eh")
c = ActiveSupport::MessageEncryptor.new(secret)
c.decrypt(b)
@SergXIIIth
SergXIIIth / buttons_radio.js.coffee
Created December 17, 2012 21:11
Automatic create and set html hidden field base on Bootstrap buttons radio values Javascript/Coffeescript plugin
# Automatic create and set html hidden field
# base on Bootstrap buttons radio values
# Javascript/Coffeescript plugin
#
# Html/Slim
# .btn-group data-toggle='buttons-radio' data-field='offer[type]' data-init-val=@offer.type
# a.btn href='#' data-val='flat' Flat
# a.btn href='#' data-val='house' House
#
# Usage
@SergXIIIth
SergXIIIth / gist:1628715
Created January 17, 2012 20:31
The first Arduino HTTP request
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0x00, 0xAB, 0xCB, 0xCD, 0xDE, 0x02 };
IPAddress ip(192,168,0,140);
IPAddress server(173,194,70,103);
EthernetClient client;
@SergXIIIth
SergXIIIth / google_map.js
Created September 12, 2011 14:09
shops on google map with filter them by country
log = function(mes){
if (console){
console.log(mes);
}
}
jQuery.fn.rank = function(min, max) {
var result = $.grep(this, function(shop){
return min <= shop.rank && shop.rank <= max
});
def iis
path = File.absolute_path "website"
path = path.gsub('/', '\\')
sh "\"c:/Program Files (x86)/IIS Express/iisexpress\" /path:#{path} /port:9090"
end
def build
cd ".."
sln = FileList["*.sln"][0]
sh "c:/Windows/Microsoft.NET/Framework64/v4.0.30319/MSBuild.exe #{sln}"
@SergXIIIth
SergXIIIth / Curl.cs
Created August 5, 2011 09:29
c# curl or rest client
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net;
using System.Text;
using System.IO;
namespace Website.Model
{
@SergXIIIth
SergXIIIth / gist:1004230
Created June 2, 2011 10:39
Mongo gridfg upload test
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using MongoDB.Driver;
using System.Web.Mvc;
using System.IO;
using MongoDB.Driver.GridFS;