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
#!/usr/bin/env python3.4 | |
#### Nyaundi Brian <ndieksman@gmail.com> | |
from pprint import pprint | |
links_string_from_header='<https://api.github.com/search/users?q=location%3AKenya&page=4>; rel="next",' \ | |
' <https://api.github.com/search/users?q=location%3AKenya&page=34>; rel="last", ' \ | |
'<https://api.github.com/search/users?q=location%3AKenya&page=1>; rel="first", ' \ | |
'<https://api.github.com/search/users?q=location%3AKenya&page=2>; rel="prev"' |
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 requests | |
import json | |
url = 'https://api.github.com/some/endpoint' | |
payload = {'some': 'data'} | |
# Create your header as required | |
headers = {"content-type": "application/json", "Authorization": "<auth-key>" } | |
r = requests.put(url, data=json.dumps(payload), headers=headers) |
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
package anim; | |
import java.awt.Dimension; | |
import java.awt.Graphics; | |
import java.awt.Image; | |
import java.io.IOException; | |
import java.net.URL; | |
import javax.imageio.ImageIO; | |
import javax.swing.JFrame; |
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
package com.company; | |
import java.util.ArrayList; | |
import java.util.Iterator; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
/** | |
* Logic 1 | |
* |
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 java.awt.BasicStroke; | |
import java.awt.Color; | |
import java.awt.Dimension; | |
import java.awt.FontMetrics; | |
import java.awt.Graphics; | |
import java.awt.Graphics2D; | |
import java.awt.Point; | |
import java.awt.RenderingHints; | |
import java.awt.Stroke; | |
import java.util.ArrayList; |
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 string ImageToBase64(Image image, | |
System.Drawing.Imaging.ImageFormat format) | |
{ | |
using (MemoryStream ms = new MemoryStream()) | |
{ | |
// Convert Image to byte[] | |
image.Save(ms, format); | |
byte[] imageBytes = ms.ToArray(); | |
// Convert byte[] to Base64 String |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
var color = '#'+(Math.random()*0xFFFFFF<<0).toString(16); | |
function changeBackground(color) { | |
document.body.style.background = color; | |
} |
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 java.awt.*; | |
import javax.swing.ImageIcon; | |
public class Bullet { | |
int x,y; | |
Image img; | |
boolean visible; |
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 java.awt.*; | |
import java.awt.event.KeyEvent; | |
import java.util.ArrayList; | |
import javax.swing.ImageIcon; | |
public class Dude { | |
int x, dx, y,nx,nx2,left, dy; | |
Image still,jump,reverse; |