Skip to content

Instantly share code, notes, and snippets.

View SET001's full-sized avatar
🇺🇦

Kostiantyn Kostiuk SET001

🇺🇦
View GitHub Profile
class Cursor{
// @include components/d2.ts
create(){
}
}
@SET001
SET001 / textBox.js
Created November 11, 2016 23:50
PHASER.js textBox plugin
class TextBox{
constructor(x, y, game){
this.lineHeight = 20
this.lineNumber = 0
this.game = game
this.x = x
this.y = y
}
write(text){
const mkdirp = require('mkdirp')
const rmdir = require('rmdir')
const fs = require('fs')
rmdir('./media/01', (err)=>{
var path = './media/01/f1/'
mkdirp(path, (err)=>{
if (err) return err
const content = "asdasd"
fs.writeFile(path + 'file.jpg', content, (err)=>{
@SET001
SET001 / blah.js
Created September 18, 2016 21:31
defered not working
fit('should not put image in request', (done)=>{
defer = $q.defer()
defer.promise.then(function(){
console.log("blah")
done()
})
defer.resolve()
})
@SET001
SET001 / register.html
Created September 7, 2016 12:29
registration form with validation - angular
<h2>{{'common.register' | translate}}</h2>
<form class="form-horizontal" style="width: 500px; margin: 0 auto" ng-submit="send()" novalidate name="registerForm">
<div class="form-group">
<label for="email" class="col-sm-3">{{'common.email' | translate}}</label>
<div class="col-sm-9">
<input
type="email"
class="form-control"
id="email"
name="email"
@SET001
SET001 / autModle.ts
Created June 5, 2016 08:16
inversify ingecting factory
interface IAuthConnection{
logIn()
logOut()
register()
}
@injectable()
export class AuthConnection implements IAuthConnection{
connection: IConnection
constructor(
window.PostsEditCtrl.push ($scope, $window, $filter, $resource, APIPosts, APIPost) ->
self = $scope
self.secure()
if !self.get('id') then self.post = new APIPosts
else
self.post = APIPost.get {id:self.get('id')}, (post) ->
self.updated_post = new APIPost self.post
self.save = ->
a[{"type":"o","uid":"p100012","eval":{"delay":1800,"oid":"p100012","effect":"jump"}}]
85
9:13:37 PM
a[{"type":"i","uid":"p100029","eval":{"login_ru":"\u041c\u0435\u0436\u0437\u0432\u0435\u0437\u0434\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432\u043e\u0437","shield":"3375","energy":"0","start_reg":1371144948,"ship":"sh/fm/e6b3a6-565071-2.0.0.0.3.0.0.0.0.0.0","speed":"1","login_be":"\u041c\u0456\u0436\u0437\u043e\u0440\u043d\u044b \u0441\u0443\u0445\u0430\u0433\u0440\u0443\u0437","struct_max":"1100","struct":"1100","energy_reg":"0","type":"s","cls":"","status":"n","poso":7.3383780942186831,"combat":null,"oid":"p100029","struct_reg":"10","moving":{"startx":1920,"starty":4604,"travellength":4389.529815367473,"traveltime":1371147184.0934691,"starttime":1371147096.3028729},"posx":6306,"posy":4780,"clan":{"clid":"100","title":{"be":"\u041f\u0440\u0430\u0444\u0441\u0430\u044e\u0437 \u0433\u0430\u043d\u0434\u043b\u044f\u0440\u043e\u045e","en":"Trader Union","ru":"\u041f\u0440\u0
self.$watch 'results.config.filters.day', (day)->
if day
date = new Date(day)
if date.getDay() is 0
start = date.getDate() - 6
else start = date.getDate() - date.getDay()
start = 1 if start<1
window.DatePickerDirective = ->
restrict: "A"
scope:
ngModel: '='
link: (scope, elem, attr, ctrl) ->
date = new Date()
if scope.ngModel.year
date.setYear scope.ngModel.year
if scope.ngModel.month
date.setMonth scope.ngModel.year