gamemaker parallax background




Information about object: obj_player
Sprite: spr_player
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object

Step Event:
execute code:

///player movement code
flying_level=200;
moving=false;
if (keyboard_check(ord('W')))
{
y-=5;
moving=true;

}
if (keyboard_check(ord('S')))
{
y+=5;
moving=true;

}

if moving=false && y<flying_level// move back to center
{
y+=2;
y=y+((flying_level-y)*0.01);


}

if moving=false && y>flying_level // move back to center
{
y-=2;
y=y-((y-flying_level)*0.01);


}

global.difference=(flying_level-y)/10;//set as a global value as it will be used for parallax background
image_angle=global.difference-10;
//keep in screen
if y<20 y=20;
if y>380 y=380;

execute code:

///parallax global.difference global.difference
background_y[1] = view_yview[0]+global.difference*0.5-100;
background_y[2] = view_yview[0]+global.difference*1-75;
background_y[3] = view_yview[0]+global.difference*2-75;

movable object that leave trail gamemaker

https://www.youtube.com/watch?v=x29Ok-VxHhw
Information about object: obj_tank
Sprite: spr_tank
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

tyre=5;//set inital tyre timer

Step Event:
execute code:

///movement code
if keyboard_check(ord('A'))
{
image_angle+=2;
direction=image_angle
}
if keyboard_check(ord('D'))
{
image_angle-=2;
direction=image_angle
}
if keyboard_check(ord('W'))
{
speed+=0.5;
}
if speed>20 speed=20;


speed-=0.2;//add friction
if speed<0 speed=0
execute code:

///tyre
tyre-=speed;

if tyre<0//if count, run the code
{
tyre=instance_create(x,y,obj_tyre);//create a tyre
tyre.image_angle=direction;//set angle to direction of tank
tyre=20;//restart timer
}


obj_tyre 
Information about object: obj_tank
Sprite: spr_tank Solid: false Visible: true Depth: 0 Persistent: false Parent: Children: Mask:
No Physics Object
Create Event:
execute code:

tyre=5;//set inital tyre timer
Step Event:
execute code:

///movement code
if keyboard_check(ord('A'))
{
image_angle+=2;
direction=image_angle
}
if keyboard_check(ord('D'))
{
image_angle-=2;
direction=image_angle
}
if keyboard_check(ord('W'))
{
speed+=0.5;
}
if speed>20 speed=20;


speed-=0.2;//add friction
if speed<0 speed=0
execute code:

///tyre
tyre-=speed;

if tyre<0//if count, run the code
{
tyre=instance_create(x,y,obj_tyre);//create a tyre
tyre.image_angle=direction;//set angle to direction of tank
tyre=20;//restart timer
}

onscreen keyboard gamemaker

Information about object: obj_button
Sprite: spr_button
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

image_speed=0;
letter = "A";//set letter
Step Event:
execute code:

if mouse_check_button_pressed(mb_left) && position_meeting(mouse_x,mouse_y,id)//if clicked
{
global.message+=letter;//add letter to string
}
if position_meeting(mouse_x,mouse_y,id)
{
image_index=1;
}
else
{
image_index=0;  
}

Draw Event:
execute code:

draw_self();
draw_set_font(fnt_button);
draw_set_halign(fa_center);
draw_text(x+16, y+4, letter);//draw letter over button

obj obj_enter 
create event:

//creating all the buttons
//top row
var alphabet = "QWERTYUIOP";
for(var i = 0; i<10; i++){
var bt = instance_create(64+i*32+(8*i), 64, obj_button);
bt.letter = string_char_at(alphabet, i+1);
}
//middle row
var alphabet = "ASDFGHJKL";
for(var i = 0; i<9; i++){
var bt = instance_create(72+i*32+(8*i), 104, obj_button);
bt.letter = string_char_at(alphabet, i+1);
}
//BOTTOM row
var alphabet = "ZXCVBNM";
for(var i = 0; i<7; i++){
var bt = instance_create(88+i*32+(8*i), 144, obj_button);
bt.letter = string_char_at(alphabet, i+1);
}

global.message="";
step event:

if mouse_check_button_pressed(mb_left) && position_meeting(mouse_x,mouse_y,id)//if clicked
{
show_message(global.message);//show typed string
game_restart();
}


draw event: draw_set_halign(fa_left);
draw_text(50,300,"Word "+global.message);//show typed text so far
draw_self();

text based gamemaker

Information about object: obj_question
Sprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

//set variables:
data=0;
q=1;
//open file and read questions:
file=file_text_open_read("questions.txt");

while (!file_text_eof(file))//loops until end of file
{
data++;
question[data,1]=file_text_read_string(file);//read question
file_text_readln(file);
question[data,2]=file_text_read_string(file);//read answer 1
file_text_readln(file);
question[data,3]=file_text_read_string(file);//read answer 2
file_text_readln(file);
question[data,4]=file_text_read_string(file);//read answer 3
file_text_readln(file);
question[data,5]=file_text_read_real(file);//read correct answer 1
file_text_readln(file);

}

file_text_close(file);
Step Event:
execute code:

if (keyboard_check_pressed(vk_left))  {q-=1;}//change question number
if (keyboard_check_pressed(vk_right))  {q+=1;}//change question number
if q==0 q=data;//keep in range
if q==(data+1) q=1;//keep in range

Draw Event:
execute code:

//draw the data
draw_text(50,100,question[q,1]);
draw_text(50,200,question[q,2]);
draw_text(50,300,question[q,3]);
draw_text(50,400,question[q,4]);
draw_text(50,500,question[q,5]);

world clock gamemaker

Information about object: obj_world_clock
Sprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

///set up variables
//set time zone
date_set_timezone(timezone_utc);//get local time
london_hour=0;
london_minute=0;
london_second=0;
newyork_hour=0;
newyork_minute=0;
newyork_second=0;
sydney_hour=0;
sydney_minute=0;
sydney_second=0;

Step Event:
execute code:

//calculations will differ depending where in the world you are
london_hour=date_get_hour(date_current_datetime());//get local time
london_minute=date_get_minute(date_current_datetime());//get local time
london_second=date_get_second(date_current_datetime());//get local time
newyork_hour=(london_hour+19+24) mod 24;//set newyork time
newyork_minute=london_minute;
newyork_second=london_second;
sydney_hour=(london_hour+10) mod 24;//set sydney time
sydney_minute=london_minute;
sydney_second=london_second;

london_hour_string=string(london_hour);
if string_length(london_hour_string)==1 london_hour_string="0"+london_hour_string;
london_minute_string=string(london_minute);
if string_length(london_minute_string)==1 london_minute_string="0"+london_minute_string;
london_second_string=string(london_second);
if string_length(london_second_string)==1 london_second_string="0"+london_second_string;

newyork_hour_string=string(newyork_hour);
if string_length(newyork_hour_string)==1 newyork_hour_string="0"+newyork_hour_string;
newyork_minute_string=string(newyork_minute);
if string_length(newyork_minute_string)==1 newyork_minute_string="0"+newyork_minute_string;
newyork_second_string=string(newyork_second);
if string_length(newyork_second_string)==1 newyork_second_string="0"+newyork_second_string;

sydney_hour_string=string(sydney_hour);
if string_length(sydney_hour_string)==1 sydneyhour_string="0"+sydney_hour_string;
sydney_minute_string=string(sydney_minute);
if string_length(sydney_minute_string)==1 sydney_minute_string="0"+sydney_minute_string;
sydney_second_string=string(sydney_second);
if string_length(sydney_second_string)==1 sydney_second_string="0"+sydney_second_string;

Draw Event:
execute code:

//draw times
draw_text(50,50,"london "+london_hour_string+":"+london_minute_string+" - "+london_second_string);
draw_text(50,150,"newyork "+newyork_hour_string+":"+newyork_minute_string+" - "+newyork_second_string);
draw_text(50,250,"sydney "+sydney_hour_string+":"+sydney_minute_string+" - "+sydney_second_string);

gantt chart vuejs

gamemaker fire projectile


obj_source
global left release

projectile=instance_create(x,y,obj_projectile);//create projectile
projectile.direction=point_direction(x,y,mouse_x,mouse_y);//set direction to mouse
projectile.speed=4;//set the speed

vuejs countdown Timer reset date

gamemaker breakout remake




Information about object:
Sprite: spr_ball
Solid: true
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object




Create Event:
execute code:

motion_set(random(180),3);//start ball moving
Collision Event with object obj_wall_tlr:
execute code:

move_bounce_all(true);//bounce off walls
Collision Event with object obj_wall_bottom:
execute code:

show_message("Game Over");//die when hit bottom
game_restart();
Collision Event with object obj_player_bat:
execute code:

move_bounce_all(true);//bounce off the bat



Collision Event with object obj_stone_blue:
execute code:

move_bounce_all(true);//bounce off brick


Information about object: obj_player_bat
Sprite: spr_player_bat Solid: false Visible: true Depth: 0 Persistent: false Parent: Children: Mask:
No Physics Object
Step Event:
execute code:

//simple movement code
if (keyboard_check(vk_left))  {x-=5;} 
if (keyboard_check(vk_right))  {x+=5;} 


Information about object: obj_stone_blue
Sprite: spr_stone_blue Solid: true Visible: true Depth: 0 Persistent: false Parent: Children: Mask:
No Physics Object
Collision Event with object <undefined>:
execute code:

instance_destroy();
Draw Event:
execute code:

draw_sprite(spr_stone_blue,0,x,y);

Pie chart maker vuejs

Gamemaker Backstab/teleport

obj_player

create event:

spawn_id = 0

step event:


inst = instance_place(x,y,obj_spawn_point)
if inst//create/update spawn point
{
spawn_id = inst
}
if (keyboard_check(ord('T')))//move to last spawn point
{
x=spawn_id.x;
y=spawn_id.y;
}
//movement code
if (keyboard_check(ord('A')))  {x-=5;}
if (keyboard_check(ord('D')))  {x+=5;}
if (keyboard_check(ord('W')))  {y-=5;}
if (keyboard_check(ord('S')))  {y+=5;}


obj_enemy

step event:

x++

Draw Text with Shadow gamemaker

obj_example:

create event:

text="This is some random text to show a shadow of text.";//set text to draw

draw event:

draw_set_font(font_example);//set the font to use
draw_set_colour(c_black);//set the colour for shadow
draw_text(40-1,40-1,text);//draw text offset
draw_set_colour(c_red);//set draw colour
draw_text(40,40,text);//draw top main text

gamemaker dictionary check

obj_dict

create event:

dictionary=ds_list_create();//create a ds list to hold words
dic_file=file_text_open_read("dictionary.txt"); //open text file with words
while(!file_text_eof(dic_file))//repeat until end of book


word=file_text_read_string(dic_file);//get next word
ds_list_add(dictionary,word);//add to ds list
file_text_readln(dic_file);//read to next line
}


step event:

word_to_find=get_string("word","");
position = ds_list_find_index(dictionary, word_to_find);
if position>0
{
show_message("Found");
}
else
{
show_message("Not Found");
}

javascript Substitution Cipher vuejs

gamemaker Spawn enemies in a random specified location

 spawn_point 

 spr_player
obj_player

create event:

spawn_x=x;//set initial spawn points
spawn_y=y;

step event:

//movement code
if (keyboard_check(ord('A')))  {x-=5;}
if (keyboard_check(ord('D')))  {x+=5;}
if (keyboard_check(ord('W')))  {y-=5;}
if (keyboard_check(ord('S')))  {y+=5;}
if (keyboard_check(ord('T')))//move to last spawn point
{
x=spawn_x;
y=spawn_y;
}

if place_meeting(x,y,obj_spawn_point)//create/update spawn point
{
spawn_x=other.x;
spawn_y=other.y;

}



raindrop game vuejs javascript

keylogger vuejs javascript

GAMEMAKER Save Highscore to INI

OBJ_SCOREHIGHSCORE

CREATE EVENT

ini_open("scores.ini");//open file
global.highscore=ini_read_real("scores","high",0);//load scores high if present, otherwise set as 0
ini_close();//close ini


DRAW EVENT

draw_text(100,100,"Highest Score:="+string(global.highscore));//draw value of global.highscore


OBJ_BUTTON

score= get_integer("Enter A Score:", 0);//get an integer
if score>global.highscore//do this if bigger than current score
{
ini_open("scores.ini");//open ini
ini_write_real("scores","high",score);//write a value
ini_close();//close value
global.highscore=score;//update highscore
show_message("High Score Updated");//message

}
else//do this if not bigger than current score
{
show_message("Score Is Not Bigger Than Current Highscore");//message
}



vuejs dice simulation

Gamemaker Substitution Cipher

create event:
alpha_src = " 0123456789abcdefghijklmnopqrstuwvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";//Plain Text
alpha_dst = "tuwvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789abcdefghijklmnopqrs";//Encoded Text
text1 = get_string("Source:", "");//Get string to convert

index = 1;//position in Plain text
str = ""; // result
for (var index = 1; index < string_length(text1)+1; index += 1)
{
char = string_char_at(text1, index);//get character at position in string
pos = string_pos(char, alpha_src);//find position of letter in Plain Text
if (pos > 0)
{
// if char occurs in source alphabet, add
// according one from destination alphabet
// to output
str += string_char_at(alpha_dst, pos);//At letter from position in Encoded
}
else
{
// otherwise just add itself
str += char;
}
}
result=str;//result is finished encoded
show_message(result);//show encoded message

Gamemaker Random Dice Roller

create event:

//set up dice
dice1=0;
dice2=0;
dice3=0;
dice4=0;
dice5=0;

step event:

if position_meeting(mouse_x,mouse_y,id) && mouse_check_button_released(mb_left)//if button press released
{
dice1=irandom_range(1,6);//choose a random value for dice
dice2=irandom_range(1,6);
dice3=irandom_range(1,6);
dice4=irandom_range(1,6);
dice5=irandom_range(1,6);
}

draw event:

draw_self();
draw_sprite(spr_dice,dice1,50,50);//draw choosen sub image
draw_sprite(spr_dice,dice2,150,50);
draw_sprite(spr_dice,dice3,250,50);
draw_sprite(spr_dice,dice4,350,50);
draw_sprite(spr_dice,dice5,450,50);





GAmeMaker Vertical Credits Scrolling

Create Event:

text="(c) Lorem##
Video - Ipsum##
Sound - Dolor##
Stunts - Sit##
Editing - Amet##
";//credits - ## for line break
x=room_width/2;//find middle of room
y=room_height+50;//start 50 pixels off of the room
height=string_height(text);//height of text in pixels


Step Event:

y-=0.5;//move up screen

if y==(0-height) instance_destroy();//if off screen destroy


Draw Event:

draw_set_halign(fa_center);//set allignment

draw_text(x,y,text);

GAME MAKER Create a Shadow

DRAW EVENT:
draw_sprite_ext(spr_duck, 0, x-2, y-2, 1, 1, -5, c_black, 1 );
draw_self();

GAMEMAKER ROOM WRAPPING

OBJ_PLAYER

STEP EVENT:


///keyboard movement
if (keyboard_check(ord('A')))  {x-=5;}
if (keyboard_check(ord('D')))  {x+=5;}
if (keyboard_check(ord('W')))  {y-=5;}
if (keyboard_check(ord('S')))  {y+=5;}
if x>room_width+1 //if off edge of room right
{
    x=1; //move to other side
}
if x<-1  //if off edge of room left
{
    x=room_width-1; //move to other side
}
if y>room_height+1 //if off edge of room bottom
{
    y=1; //move to other side
}
if y<-1 //if off edge of room top
{
    y=room_height-1; //move to other side
}

game controller vuejs

[gamemaker] Pop-Up RPG Style Text Box

obj_message


create_event


global.message=ds_list_create();//create a ds list to hold messages
can_show=true;//set that a message can show
to_draw="";//set text to draw to ""

alarm 0 event


///alarm0 set alarm1
alarm[1]=room_speed*1;//create a short pause
to_draw="";//remove text to show


alarm 1 event:


///set as able to show
can_show=true;//allow message to show


step event:


///check if message waiting
check=ds_list_size(global.message);//get no of messages waiting
if check>0 && can_show//do this if more than one message and can show
{
to_draw=ds_list_find_value(global.message,0);//get message from top of ds list
ds_list_delete(global.message,0);//delete this message
can_show=false;//prevent showing
alarm[0]=room_speed*4;//create a pause
}


draw event:


///draw message

if to_draw!=""//do if there is a message waiting
{
//draw a background box
draw_set_colour(c_blue);
draw_rectangle(100,280,700,320,false);
//draw a message
draw_set_font(font_message);
draw_set_halign(fa_center);
draw_set_valign(fa_middle);
draw_set_colour(c_red);
draw_text(400+1,300+1,to_draw);
draw_set_colour(c_white);
draw_text(400,300,to_draw);
}


obj_player

release event:

//choose an example message and sent to script
message=choose("this is a message","this another message","this is yet another message");
scr_message(message);

scr_message


//add message to a ds list
ds_list_add(global.message,argument0);

vuejs trading card duel example

[GAMEMAKER] Random Sentence Generator

create event:
sentence="";

draw event:
draw_text(50,50,sentence);

press s event:
name=choose("Edward","Lance","Lorilla");
what=choose("went swimming","ate chocolate");
where=choose("in the park","at the cinema","at the beach");
name2=choose("with Lorem","with Ipsum","With Dolor");
when=choose("on Monday","yesterday","last week");
space=" ";
sentence=name+space+what+space+where+space+name2+space+when;

GAMEMAKER Firework Display Using Effects

Step event:
//create firework effect at random position in room,with random size and colour
effect_create_above(ef_firework,random(room_width),random(room_height),irandom(2),choose(c_yellow,c_red,c_blue,c_green));

single linked list [PUSH] vue

Reverse Sentence Order gamemaker


create event: 

msg = "one two three for five"; //string to split
reversed="";//initialize string
splits[0]="";//initialize array
splitBy = " "; //string to split the first string by
slot = 0;//starting slot
str2 = ""; //var to hold the current split we're working on building


for (var i = 1; i < (string_length(msg)+1); i++)
{
currStr = string_copy(msg, i, 1);//get character 1 by 1
if (currStr == splitBy)//split if [space] found
{
splits[slot] = str2; //add this split to the array of all splits
slot++;
str2 = "";
}
else
{
str2 = str2 + currStr;
splits[slot] = str2;//add last word
}
}
//add back to a new string

for(var i = slot; i >-1 ; i -= 1)//start a number of slots and reduce i by one each loop
{
reversed+=splits[i]+" ";
}


draw event:

draw_text(50,40,reversed);




vuejs web crawler

<script src="https://gist.github.com/edwardlorilla/db6ae50305865ba1059538323290db1c.js"></script>

VB NET dramacool download web crawler


Imports System.ComponentModel
Imports System.Net
Imports System.Text.RegularExpressions

Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("https://www4.dramacool9.io/meteor-garden-2018-episode-27.html")

        Dim response As System.Net.HttpWebResponse = request.GetResponse
        Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream)
        Dim rssourceCode As String = sr.ReadToEnd

        Dim r As New Regex("<h3 class=""title"" onclick=""window.location = '([^<]*)'"">([^<]*)</h3>")
        Dim matches As MatchCollection = r.Matches(rssourceCode)

        For Each itemcode As Match In matches
            ListBox1.Items.Add(itemcode.Groups(1).ToString)

        Next
    End Sub

    Private Sub ListBox1_DoubleClick(sender As Object, e As EventArgs) Handles ListBox1.DoubleClick
        MessageBox.Show(ListBox1.SelectedItem.ToString)
        Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("https://www4.dramacool9.io" + ListBox1.SelectedItem.ToString)

        Dim response As System.Net.HttpWebResponse = request.GetResponse
        Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream)
        Dim rssourceCode As String = sr.ReadToEnd

        Dim r As New Regex("<iframe allowfullscreen=""true"" webkitallowfullscreen=""true"" mozallowfullscreen=""true"" marginheight=""0"" marginwidth=""0"" scrolling=""no"" frameborder=""0"" style=""width: 100%"" src=""([^<]*)"" target=""_blank""></iframe>")
        Dim matches As Match = r.Match(rssourceCode)

        Dim downloadRequest As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("https:" & matches.Groups(1).ToString())
        Dim downloadresponse As System.Net.HttpWebResponse = downloadRequest.GetResponse
        Dim dsr As System.IO.StreamReader = New System.IO.StreamReader(downloadresponse.GetResponseStream)
        Dim downloadrssourceCode As String = dsr.ReadToEnd
        Dim downloadRegex As New Regex("file: '([^<]*)',label: 'auto P','type' : 'mp4'")
        Dim downloadMatches As Match = downloadRegex.Match(downloadrssourceCode)
        Dim client As WebClient = New WebClient
        AddHandler client.DownloadProgressChanged, AddressOf client_ProgressChanged
        AddHandler client.DownloadFileCompleted, AddressOf client_DownloadCompleted
        client.DownloadFileAsync(New Uri(downloadMatches.Groups(1).ToString()), "E:\meteor garden" & ListBox1.SelectedItem.ToString)
    End Sub

    Private Sub client_DownloadCompleted(sender As Object, e As AsyncCompletedEventArgs)
        MessageBox.Show("Download Complete")
    End Sub

    Private Sub client_ProgressChanged(sender As Object, e As DownloadProgressChangedEventArgs)
        Dim bytesIn As Double = Double.Parse(e.BytesReceived.ToString())
        Dim totalBytes As Double = Double.Parse(e.TotalBytesToReceive.ToString())
        Dim percentage As Double = bytesIn / totalBytes * 100
        Label1.Text = percentage
        ProgressBar1.Value = Int32.Parse(Math.Truncate(percentage).ToString())
    End Sub

    Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged

    End Sub
End Class

vuejs ascii <---to---> hex converter

https://gist.github.com/edwardlorilla/0bb499c5bad42c16773173260b7d910b

Dart ascii to hex

ascii_to_hex(form) { var symbols = " !\"#\$%&'()*+,-./0123456789:;<=>?@"; var loAZ = "abcdefghijklmnopqrstuvwxyz"; symbols += loAZ.toUpperCase(); symbols += "[\\]^_`"; symbols += loAZ; symbols += "{|}~"; var valueStr = form; var hexChars = "0123456789abcdef"; var text = ""; for( var i=0; i Divide, returning an integer result if ( text != "" ) text += " "; text += hexChars[index2]; text += hexChars[index1]; } return text; } void main() { print(ascii_to_hex('form')); }

Dart Equality and Relational Operators

void main() { var num1 = 5; var num2 = 9; var res = num1 > num2; print('num1 greater than num2 :: ' + res.toString()); res = num1 < num2; print('num1 lesser than num2 :: ' + res.toString()); res = num1 >= num2; print('num1 greater than or equal to num2 :: ' + res.toString()); res = num1 <= num2; print('num1 lesser than or equal to num2 :: ' + res.toString()); res = num1 != num2; print('num1 not equal to num2 :: ' + res.toString()); res = num1 == num2; print('num1 equal to num2 :: ' + res.toString()); }

laravel Schema builder prototype and controller

dart: arithmetic operators

void main() { var num1 = 101; var num2 = 2; var res = 0; res = num1+num2; print("Addition: ${res}"); res = num1-num2; print("Subtraction: ${res}"); res = num1*num2; print("Multiplication: ${res}"); res = num1/num2; print("Division: ${res}"); res = num1~/num2; print("Division returning Integer: ${res}"); res = num1%num2; print("Remainder: ${res}"); num1++; print("Increment: ${num1}"); num2--; print("Decrement: ${num2}"); }

vuejs laravel Schema builder prototype

Dart: Function Area Converter

area(area, value) {
  double acre = 0.0,
  square_mile = 0.0,
  square_foot = 0.0,
  square_inch = 0.0,
  square_km = 0.0,
  square_meter = 0.0,
  hectare = 0.0,
  square_yard = 0.0;
 
  if (area == 'acre') {
    hectare = value * 0.404686;
    square_foot = value * 43560;
    square_inch = value * 6.273e6;
    square_km = value * 0.00404686;
    square_meter = value * 4046.86;
    square_mile = value * 0.0015625;
    square_yard = value * 4840;
  } else if (area == 'square_mile') {
    acre = value * 640;
    square_foot = value * 2.788e7;
    square_inch = value * 4.014e9;
    square_km = value * 2.58999;
    square_meter = value * 2.59e6;
    hectare = value * 258.999;
    square_yard = value * 3.098e6;
  } else if (area == 'square_foot') {
    acre = value * 2.2957e-5;
    hectare = value * 9.2903e-6;
    square_inch = value * 144;
    square_km = value * 9.2903e-8;
    square_meter = value * 0.092903;
    square_mile = value * 3.587e-8;
    square_yard = value * 0.111111;
  } else if (area == 'square_inch') {
    acre = value * 1.5942e-7;
    square_foot = value * 0.00694444;
    hectare = value * 6.4516e-8;
    square_km = value * 6.4516e-10;
    square_meter = value * 0.00064516;
    square_mile = value * 2.491e-10;
    square_yard = value * 0.000771605;
  } else if (area == 'square_km') {
    acre = value * 247.105;
    square_foot = value * 1.076e7;
    square_inch = value * 1.55e9;
    hectare = value * 100;
    square_meter = value * 1e6;
    square_mile = value * 0.386102;
    square_yard = value * 1.196e6;
  } else if (area == 'square_meter') {
    acre = value * 0.000247105;
    square_foot = value * 10.7639;
    square_inch = value * 1550;
    square_km = value * 1e-6;
    hectare = value * 1e-4;
    square_mile = value * 3.861e-7;
    square_yard = value * 1.19599;
  } else if (area == 'hectare') {
    acre = value * 2.47105;
    square_foot = value * 107639;
    square_inch = value * 1.55e7;
    square_km = value * 0.01;
    square_meter = value * 10000;
    square_mile = value * 0.00386102;
    square_yard = value * 11959.9;
  } else if (area == 'square_yard') {
    acre = value * 0.000206612;
    square_foot = value * 9;
    square_inch = value * 1296;
    square_km = value * 8.3613e-7;
    square_meter = value * 0.836127;
    square_mile = value * 3.2283e-7;
    hectare = value * 8.3613e-5;
  }
  return "acre:$acre \nsquare_foot:$square_foot\nsquare_inch:$square_inch\nsquare_km:$square_km\nsquare_meter:$square_meter\nhectare:$hectare\nsquare_yard:$square_yard";
}

void main() {
  print(area('square_foot', 2));
}

Area Converter Dart

void main() {
  double acre = 0.0,
  square_mile = 5.0,
  square_foot = 0.0,
  square_inch = 0.0,
  square_km = 0.0,
  square_meter = 0.0,
  hectare = 0.0,
  square_yard = 0.0;
 
  acre = square_mile * 640;
  square_foot = square_mile * 2.788e7;
  square_inch = square_mile * 4.014e9;
  square_km = square_mile * 2.58999;
  square_meter = square_mile * 2.59e6;
  hectare = square_mile * 258.999;
  square_yard = square_mile * 3.098e6;
 
  print("acre:$acre \nsquare_foot:$square_foot\nsquare_inch:$square_inch\nsquare_km:$square_km\nsquare_meter:$square_meter\nhectare:$hectare\nsquare_yard:$square_yard");
}

multipart element ui

<form name="documentForm" ref="form" @submit.prevent = "store$" method="post" enctype="multipart/form-data">
<el-upload        :on-change="handleChange"        :file-list="create$.file"        action=""        class="upload-demo"        ref="upload"        multiple        :auto-upload="false">
    <v-btn slot="trigger">Upload</v-btn>
</el-upload>
<v-btn color="blue darken-1" flat form="documentForm" type="submit">Save</v-btn>
</form>
new Vue({
methods:{
store$(){
    var vm = this    var store$ = new FormData(vm.$refs.form);    store$.append('category_id', vm.create$.category_id )
    _.map(vm.create$.file, function(data){
        store$.append('file[]', data.raw )
    })


    post('/api/documents', store$).then(function (response) {
        vm.$set(vm.$root.$data.documents, vm.$root.$data.documents.length, response.data )
        vm.$root.successResponse('Create A Document')
        vm.$router.push('/documents')
    }).catch(function (_ref2) {
        vm.$root.errorResponse(_ref2)
    });

}
})

Table display in Vuejs vue tables 2 sort

creating and loading a module nodejs

//app.js
var logger = require('./logger.js');logger('edward');

//logger.js

var url = 'edward.io';function log(message) {
    console.log(message)
}

module.exports = log;

typing indicator css

advertisement system vuejs

HTML5 Upload base64 Form App Script Google Sheet

forms.html

<!DOCTYPE html>
<html>
 <head>
   <base target="_blank">
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>Registration</title>
   <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
   <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.5/css/materialize.min.css">
   <style>
     .disclaimer{width: 480px; color:#646464;margin:20px auto;padding:0 16px;text-align:center;font:400 12px Roboto,Helvetica,Arial,sans-serif}.disclaimer a{color:#009688}#credit{display:none}
   </style>
 </head>
 <body>

   <form class="main" id="form" novalidate="novalidate" style="max-width: 480px;margin: 40px auto;">
     <div id="forminner">
       <div class="row">
         <div class="col s12">
           <h5 class="center-align teal-text">Registration</h5>
           <p class="disclaimer">Fill up all fields.</p>
         </div>
       </div>
       <div class="row">
         <div class="input-field col s12">
           <input id="name" type="text" name="Name" class="validate" required="" aria-required="true">
           <label for="name">Name</label>
         </div>
       </div>
       <div class="row">
         <div class="input-field col s12">
           <input id="pid" type="text" name="Pid" class="validate" required="" aria-required="true">
           <label for="pid">Pid</label>
         </div>
       </div>      
       <div class="row">
         <div class="input-field col s12">
           <input id="email" type="email" name="Email" class="validate" required="" aria-required="true">
           <label for="email">Email Address</label>
         </div>
       </div>
       <div class="row">
         <div class="input-field col s12">
           <input id="tel" type="tel" name="Tel" class="validate" required="" aria-required="true">
           <label for="tel">Telephone</label>
         </div>
       </div>
       <div class="row">
       <div class="input-field col s12">
       <select id="position" name="position">
           <option value="" disabled selected>Position</option>
           <option value="Head">Head</option>
           <option value="Assistant">Assistant</option>
           <option value="Secretary">Secretary</option>
           <option value="Others">Others</option>
       </select>
       </div>
       </div>

       <div class="row">
         <div class="file-field input-field col s12">
           <div class="btn">
             <span>File</span>
             <input id="files" type="file">
           </div>
           <div class="file-path-wrapper">
             <input class="file-path validate" type="text" placeholder="Select a file on your computer">
           </div>
         </div>
       </div>

       <div class="row">
         <div class="input-field col s6">
           <button class="waves-effect waves-light btn submit-btn" type="submit" onclick="submitForm(); return false;">Submit</button>
         </div>
       </div>
       <div class="row">
         <div class="input-field col s12" id = "progress">
         </div>
       </div>
     </div>
     <div id="success" style="display:none">
       <h5 class="left-align teal-text">File Uploaded</h5>
       <p>Your file has been successfully uploaded.</p>
       <p class="center-align"><a  class="btn btn-large" onclick="restartForm()" >Restart</a></p>
     </div>
   </form>


   <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
   <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.5/js/materialize.min.js"></script>


   <script>

     var file, reader = new FileReader();

     reader.onloadend = function(e) {
       if (e.target.error != null) {
         showError("File " + file.name + " could not be read.");
         return;
       } else {
         google.script.run
           .withSuccessHandler(showSuccess)
           .uploadFileToGoogleDrive(e.target.result, file.name, $('input#name').val(),
                   $('input#pid').val(), $('input#email').val(), $('input#tel').val()),
                   $('input#position').val();
       }
     };

     function showSuccess(e) {
       if (e === "OK") {
         $('#forminner').hide();
         $('#success').show();
       } else {
         showError(e);
       }
     }

     function restartForm() {
     $('#form').trigger("reset");
         $('#forminner').show();
         $('#success').hide();
         $('#progress').html("");
       }

     function submitForm() {

       var files = $('#files')[0].files;

       if (files.length === 0) {
         showError("Please select a file to upload");
         return;
       }

       file = files[0];

       if (file.size > 1024 * 1024 * 5) {
         showError("The file size should be < 5 MB. ");
         return;
       }

       showMessage("Uploading file..");

       reader.readAsDataURL(file);

     }

     function showError(e) {
       $('#progress').addClass('red-text').html(e);
     }

     function showMessage(e) {
       $('#progress').removeClass('red-text').html(e);
     }

       $(document).ready(function() {
                                   $('select').material_select();
                         });

   </script>

 </body>

</html>
Code.gs

//  1. Enter sheet name where data is to be written below
        var SHEET_NAME = "Sheet1";
//  2. Run > setup
//
//  3. Publish > Deploy as web app
//    - enter Project Version name and click 'Save New Version'
//    - set security level and enable service (most likely execute as 'me' and access 'anyone, even anonymously)
//
//  4. Copy the 'Current web app URL' and post this in your form/script action
//
//  5. Insert column names on your destination sheet matching the parameter names of the data you are passing in (exactly matching case)
var SCRIPT_PROP = PropertiesService.getScriptProperties(); // new property service
function doGet(e) {
  return HtmlService.createHtmlOutputFromFile('forms.html').setTitle("Registration With Document");
}
function uploadFileToGoogleDrive(data, file, name, pid, email, tel, position) {

  try {
   
    var dropbox = "Received Files";
    //var folder, folders = DriveApp.getFoldersByName(dropbox);
    var folder=DriveApp.getFolderById('0B86b-ALn-1MGSndHQ2NQMlExNVE');
    /*
    if (folders.hasNext()) {
      folder = folders.next();
    } else {
      folder = DriveApp.createFolder(dropbox);
    }
    */
    /* Credit: www.labnol.org/awesome */
   
    var contentType = data.substring(5,data.indexOf(';')),
        bytes = Utilities.base64Decode(data.substr(data.indexOf('base64,')+7)),
        blob = Utilities.newBlob(bytes, contentType, file),
        file = folder.createFolder([name, email].join(" ")).createFile(blob),
        filelink=file.getUrl() ;
  var lock = LockService.getPublicLock();
  lock.waitLock(30000);  // wait 30 seconds before conceding defeat.    
   
    // next set where we write the data - you could write to multiple/alternate destinations
    var doc = SpreadsheetApp.openById(SCRIPT_PROP.getProperty("key"));
    var sheet = doc.getSheetByName(SHEET_NAME);
    // we'll assume header is in row 1 but you can override with header_row in GET/POST data
    var headRow =  1;
    var headers = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues()[0];
    var nextRow = sheet.getLastRow()+1; // get next row
    var row = [];
    // loop through the header columns
    for (i in headers){
      if (headers[i] == "Timestamp"){ // special case if you include a 'Timestamp' column
        row.push(new Date());
      } else if (headers[i] == "name"){
        row.push(name);
      } else if (headers[i] == "pid"){
        row.push(pid);
      } else if (headers[i] == "email"){
        row.push(email);
      } else if (headers[i] == "tel"){
        row.push(tel);
      } else if (headers[i] == "position"){
        row.push(position);
      } else if (headers[i] == "filelink"){
        row.push(filelink);
      }
       
    }
    // more efficient to set values as [][] array than individually
    sheet.getRange(nextRow, 1, 1, row.length).setValues([row]);
   
    // return json success results
    //return ContentService
    //      .createTextOutput(JSON.stringify({"result":"success", "row": nextRow}))
    //      .setMimeType(ContentService.MimeType.JSON);    
   
   
    return "OK";
   
  } catch (f) {
    return f.toString();
  } finally { //release lock
    lock.releaseLock();
  }

}
function setup() {
    var doc = SpreadsheetApp.getActiveSpreadsheet();
    SCRIPT_PROP.setProperty("key", doc.getId());
}

How to build deeper, more robust relationships | Carole Robin (Stanford GSB professor, “Touchy Feely”)

Listen now (87 mins) | Brought to you by: • Eppo—Run reliable, impactful experiments • CommandBar—AI-powered user assistance for modern prod...

Contact Form

Name

Email *

Message *