Skip to content

Instantly share code, notes, and snippets.

View alexesDev's full-sized avatar

Alexey Yurchenko alexesDev

  • Digital Nomad
View GitHub Profile
@alexesDev
alexesDev / gist:3440409
Created August 23, 2012 19:05
Auto update styles every 10s
jQuery (j) =>
setInterval ->
$('link[rel="stylesheet"]').each -> @href = @href.replace(/\?.*|$/, '?reload=' + new Date().getTime())
, 100
@alexesDev
alexesDev / gist:3566519
Created September 1, 2012 07:34
APPLICATION init script
#!/bin/bash
### BEGIN INIT INFO
# Provides: APPLICATION
# Required-Start: $all
# Required-Stop: $network $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the APPLICATION unicorns at boot
# Description: Enable APPLICATION at boot time.
@alexesDev
alexesDev / gist:3584731
Created September 1, 2012 19:36
Make 3D lines from root
int centerX = size / 2;
int centerZ = size / 2;
data[idx(centerX, size - 1, centerZ)] = 1;
for(int i = 0; i < 128; ++i)
{
int endX = std::rand() % (size - 1);
int endZ = std::rand() % (size - 1);
@alexesDev
alexesDev / user.rb
Created September 20, 2012 12:52 — forked from kirs/user.rb
Example User model for Inboxes gem
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
attr_accessible :email, :password, :password_confirmation, :remember_me, :name
validates :name, :presence => true, :uniqueness => true
has_inboxes
end
@alexesDev
alexesDev / gist:3766252
Created September 22, 2012 14:02
Simple L-System
struct State
{
vector3df rotate;
vector3df prevPoint;
State() : rotate(vector3df()) {}
State(const State& other) : rotate(other.rotate), prevPoint(other.prevPoint) { }
};
typedef std::vector<line3df> Lines;
@alexesDev
alexesDev / gist:3766258
Created September 22, 2012 14:04
Simple L-System with Irrlicht render
#include <irrlicht.h>
#include <vector>
#include <iostream>
#include <stack>
#include <map>
#include <functional>
using namespace irr;
using namespace core;
using namespace scene;
struct MapVector3
{
Ogre::Vector3 point;
MapVector3(const Ogre::Vector3 &_point) : point(_point) {}
bool operator<( const MapVector3 &rhs ) const
{
if( point.x < rhs.point.x )
return true;
else if( point.x == rhs.point.x )
float discreteNoise( uint32 x )
{
uint32 t;
x=(x<<13)^x;
t = x*790169+x*x*x*15731 + 1376312588;
return (float)( 1.0-(t%1073741824)/536870912.0 );
}
float discreteNoise(uint32 x,uint32 y )
{
#include <stdio.h>
#include <math.h>
int main(void)
{
double x, y;
printf("Введите координату x >");
scanf("%lf", &x);
#include <stdio.h>
#include <math.h>
#define SIZE 9
int matrix[SIZE][SIZE];
int main(void)
{
int x, y, step;