Skip to content

Instantly share code, notes, and snippets.

View joe-oli's full-sized avatar
💭
what the flock? no status to report, i am not a facebook junkie.

joe-oli

💭
what the flock? no status to report, i am not a facebook junkie.
View GitHub Profile
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@joe-oli
joe-oli / square-brackets-react.txt
Created November 7, 2019 14:26
Square brackets in React
What do square brackets [] around e.target.name mean?
this.setState({ [e.target.name] : e.target.value});
Instead of this:
<input type="text" name="title" onChange={this.onTitleChange} value={this.state.title} />
<input type="text" name="address" onChange={this.onAddressChange} value={this.state.address} />
<input type="text" name="description" onChange={this.onDescriptionChange} value={this.state.description} />
onTitleChange (e) {
@joe-oli
joe-oli / wireless-access-point.txt
Last active January 1, 2020 12:21
Setup Wireless access point
Windows 10 includes a feature called "Hosted Network" that allows you to turn your computer into a wireless hotspot,
Use the Windows key + X keyboard shortcut, and select Command Prompt (Admin).
#1 Open win cmd prompt (Run as Admin)
#2 Does your Wireless Adapter (hardware device) support Hosted Network ?
(IF NOT, you are out of luck; try using another external USB wireless adapter that supports the feature).
)
>NETSH WLAN show drivers
@joe-oli
joe-oli / encode-decode-to-base64.cs
Last active November 19, 2019 06:53
encode / decode string to/from base64
//Encode
public static string Base64Encode(string plainText) {
var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText);
return System.Convert.ToBase64String(plainTextBytes);
}
//Decode
public static string Base64Decode(string base64EncodedData) {
var base64EncodedBytes = System.Convert.FromBase64String(base64EncodedData);
@joe-oli
joe-oli / XmlLinqConversionExtensions.cs
Created November 12, 2019 18:12 — forked from ChuckSavage/XmlLinqConversionExtensions.cs
Convert To/From XmlDocument and XDocument/XElements
using System.Xml;
using System.Xml.Linq;
namespace XmlLib
{
/// <summary>
/// Provides extension methods for simple conversion between System.Xml and System.Xml.Linq classes.
/// </summary>
/// <remarks>From: http://brianary.blogspot.com/2010/02/converting-between-xdocument-and.html</remarks>
public static class XmlLinqConversionExtensions
@joe-oli
joe-oli / Convert-Xml-to-Xml.Linq.cs
Last active November 12, 2019 18:23
XmlElement to XElement and XmlDocument to XDocument
public static XElement ToXElement(this XmlElement xmlelement)
{
return XElement.Load(xmlelement.CreateNavigator().ReadSubtree());
}
public static XmlDocument ToXmlDocument(this XDocument xdoc)
{
var xmldoc = new XmlDocument();
xmldoc.Load(xdoc.CreateReader());
return xmldoc;
@joe-oli
joe-oli / array-of-json-objects.json
Created November 13, 2019 09:55
Array of JSON Objectss, can this be retrieved by ajax ?
[{
"id": 1,
"name": "akira"
},
{
"id": 2,
"name": "fubuki"
},
{
"id": 3,
@joe-oli
joe-oli / search-own-gists.txt
Last active November 14, 2019 20:52
search for my own gists only
Go to Gist home, https://gist.github.com/
In githubs search type:
---
user:joe-oli whatever you want to search
Other searches:
------
Get all gists from the user santisbon.
@joe-oli
joe-oli / data-movies.json
Created November 16, 2019 03:02
sample movies data
[
{
"Title": "Under the Silver Lake",
"Year": "2018",
"Director": "David Robert Mitchell",
"Actors": "Andrew Garfield, Wendy Vanden Heuvel, Deborah Geffner, Riley Keough",
"Plot": "Sam, intelligent but without purpose, finds a mysterious woman swimming in his apartment's pool one night. The next morning, she disappears. Sam sets off across LA to find her, and along the way he uncovers a conspiracy far more bizarre."
},
{
"Title": "The Appearance",
@joe-oli
joe-oli / bootstrap-breakpoints.txt
Created November 17, 2019 21:25
bootstrap media queries.
On the Bootstrap 3 media queries documentation it says:
We use the following media queries in our Less files to create the key breakpoints in our grid system.
Extra small devices (phones, less than 768px): No media query since this is the default in Bootstrap
Small devices (tablets, 768px and up): @media (min-width: @screen-sm-min) { ... }
Medium devices (desktops, 992px and up): @media (min-width: @screen-md-min) { ... }