This file contains 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
public class FooClass | |
{ | |
public string name; | |
} | |
public struct FooStruct | |
{ | |
public string name; | |
} | |
public static class Example |
This file contains 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
//Works only in build game, does not work when run inside editor | |
if (Input.GetKeyDown(KeyCode.Escape)) | |
{ | |
Application.Quit(); | |
} |
This file contains 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
GameObject my_game_object = (GameObject)Resources.Load("BIP", typeof(GameObject)); | |
Instantiate(my_game_object); | |
Instantiate(my_game_object); //we can Instantiate the prefab many times and creates mane game object from it | |
my_game_object = null; |
This file contains 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
//Writing | |
//Set bit to 1 | |
my_byte = my_byte | (1 << pos); // longer version, or | |
my_byte |= 1 << pos; // shorthand | |
//Set bit to 0 | |
my_byte = my_byte & ~(1 << pos); // longer version, or | |
my_byte &= ~(1 << pos); // shorthand | |
//Reading | |
var bit = (b & (1 << bitNumber-1)) != 0; |
This file contains 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 base64, requests, json | |
def header(user, password): | |
credentials = user + ':' + password | |
token = base64.b64encode(credentials.encode()) | |
header_json = {'Authorization': 'Basic ' + token.decode('utf-8')} | |
return header_json | |
def create_post(content,title, url, header_json): | |
post = { |
This file contains 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 base64, requests, json | |
def header(user, password): | |
credentials = user + ':' + password | |
token = base64.b64encode(credentials.encode()) | |
header_json = {'Authorization': 'Basic ' + token.decode('utf-8')} | |
return header_json | |
def create_page(content,title, url, header_json): | |
post = { |
This file contains 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 base64, requests, json | |
def header(user, password): | |
credentials = user + ':' + password | |
token = base64.b64encode(credentials.encode()) | |
header_json = {'Authorization': 'Basic ' + token.decode('utf-8')} | |
return header_json | |
def upload_image_to_wordpress(file_path, url, header_json): | |
media = {'file': open(file_path,"rb"),'caption': 'My great demo picture'} |
This file contains 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
private static List<string> GetListOfFilesInFolder(string path) | |
{ | |
string[] fileEntries = System.IO.Directory.GetFiles(path); | |
List<string> result = new List<string>(); | |
foreach(string f in fileEntries) | |
{ | |
if(System.IO.File.Exists(f)) | |
{ | |
result.Add(f); | |
} |
This file contains 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 bs4 as bs | |
import urllib.request | |
sauce = urllib.request.urlopen('https://singularityhub.com/').read() | |
soup = bs.BeautifulSoup(sauce, 'lxml') | |
for url in soup.find_all('a'): | |
#print(url) | |
print(url.text) | |
print(url.get('href')) |
This file contains 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 bs4 as bs | |
import urllib.request | |
import time | |
def filter_to(input_list,limit_to): | |
res = [] | |
for i in input_list: | |
if i is not None: | |
if limit_to in i: | |
res.append(i) |
NewerOlder