Skip to content

Instantly share code, notes, and snippets.

View adam-hanna's full-sized avatar
💭
breaking things...

Adam Hanna adam-hanna

💭
breaking things...
View GitHub Profile
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 24, 2024 06:12
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@KWMalik
KWMalik / interviewitems.MD
Created September 16, 2012 22:04 — forked from amaxwell01/interviewitems.MD
My answers to over 100 Google interview questions

##Google Interview Questions: Product Marketing Manager

  • Why do you want to join Google? -- Because I want to create tools for others to learn, for free. I didn't have a lot of money when growing up so I didn't get access to the same books, computers and resources that others had which caused money, I want to help ensure that others can learn on the same playing field regardless of their families wealth status or location.
  • What do you know about Google’s product and technology? -- A lot actually, I am a beta tester for numerous products, I use most of the Google tools such as: Search, Gmaill, Drive, Reader, Calendar, G+, YouTube, Web Master Tools, Keyword tools, Analytics etc.
  • If you are Product Manager for Google’s Adwords, how do you plan to market this?
  • What would you say during an AdWords or AdSense product seminar?
  • Who are Google’s competitors, and how does Google compete with them? -- Google competes on numerous fields: --- Search: Baidu, Bing, Duck Duck Go
@widyakumara
widyakumara / resizecrop.py
Created November 30, 2012 15:49
simple resize & crop with python & PIL (using ImageOps)
import PIL
from PIL import Image, ImageOps
def resizecrop(src, out, width, height):
img = Image.open(src)
img = ImageOps.fit(img, (width, height), Image.ANTIALIAS, 0, (0.5, 0.5))
img.save(out)
// Created by STRd6
// MIT License
// jquery.paste_image_reader.js
(function($) {
var defaults;
$.event.fix = (function(originalFix) {
return function(event) {
event = originalFix.apply(this, arguments);
if (event.type.indexOf('copy') === 0 || event.type.indexOf('paste') === 0) {
event.clipboardData = event.originalEvent.clipboardData;
@tonyhb
tonyhb / main.go
Created June 20, 2013 00:19
Golang: Converting a struct to a map (to a url.Values string map)
package main
import (
"fmt"
"net/url"
"reflect"
"strconv"
)
type Person struct {
@lpereira
lpereira / gist:6694015
Last active January 26, 2016 23:11
How to use sequences with lwan template
#include <assert.h>
#include <sys/types.h>
#include <dirent.h>
#include "lwan-status.h"
#include "lwan-template.h"
#include "strbuf.h"
struct file_list {
const char *path;
@dbfin
dbfin / grub2_options_update_f.sh
Last active November 29, 2023 11:41
Update grub in Fedora
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
@plentz
plentz / nginx.conf
Last active June 21, 2024 14:21
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@pramodtech
pramodtech / webkitOfflineAudioContext.js
Created January 10, 2014 06:01
Html5 web audio api - Offline rendering
window.onload = init;
var context;
var bufferLoader;
var offline;
function init() {
// Fix up prefixing
window.AudioContext = window.AudioContext || window.webkitAudioContext;
context = new AudioContext();
bufferLoader = new BufferLoader(