Skip to content

Instantly share code, notes, and snippets.

@pandafulmanda
pandafulmanda / Python3 Virtualenv Setup.md
Last active July 19, 2024 20:02 — forked from akszydelko/Python3 Virtualenv Setup.md
Setting up and using Python3 Virtualenv on Mac

Python3 Virtualenv Setup

Requirements
  • Python 3
  • Pip 3
$ brew install python3
@doobeh
doobeh / vort.html
Created March 2, 2016 19:40
DatePicker JS Example Flask
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>DatePicker Example</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script>
@vinhnx
vinhnx / remove-bottom-line-navbar.md
Last active June 14, 2022 02:32
remove 1px bottom line of the navigation bar

If you just want to use a solid navigation bar color and have set this up in your storyboard, use this code in your AppDelegate class to remove the 1 pixel border via the appearance proxy:

Objective-C

[[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc] init]
                                  forBarPosition:UIBarPositionAny
                                      barMetrics:UIBarMetricsDefault];

[[UINavigationBar appearance] setShadowImage:[[UIImage alloc] init]];
@hlung
hlung / How to connect PS3 controller to a Mac or PC.md
Last active July 22, 2024 21:41
How to connect PS3 controller to a Mac or PC

How to connect PS3 controller to a Mac or PC

This is how you connect PS3 controller to Mac OSX, PC, etc. when previously connected to a PS3. You will need a Mini USB cable. Overcome your laziness, get up of your chair, and go get one!

A big misconception is that keep holding PS button will reset the controller's pairing. It DOES NOT! From my testings, the controller keeps paring with the last machine it was CONNECTED VIA A USB CABLE.

Here are the steps:

@mazz
mazz / gist:4259594
Created December 11, 2012 15:56
uses CGImageCreateWithImageInRect to perform a crop
// this chunk of code loads a jpeg image into a cgimage
// creates a second crop of the original image with CGImageCreateWithImageInRect
// writes the new cropped image to the desktop
// ensure that the xy origin of the CGRectMake call is smaller than the width or height of the original image
NSURL *originalImage = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"lockwood" ofType:@"jpg"]];
CGImageRef imageRef = NULL;
CGImageSourceRef loadRef = CGImageSourceCreateWithURL((CFURLRef)originalImage, NULL);
if (loadRef != NULL)
@benlesh
benlesh / Program.cs
Created August 15, 2012 15:09
A basic digitally signed token in C#. More info at: http://www.benlesh.com/2012/08/creating-digitally-signed-security.html
class Program
{
static void Main(string[] args)
{
TokenTesting();
}
private static void TokenTesting()
{
// create a private key to use in our tests.
@fish2000
fish2000 / flushemailqueue.py
Created October 16, 2010 10:51
Database email queue
#!/usr/bin/env python
# encoding: utf-8
import sys, os, getopt
from django.core.management import setup_environ
import settings
setup_environ(settings)
from django.db.models import Q