Skip to content

Instantly share code, notes, and snippets.

@DustyReagan
DustyReagan / Twitter User Object MySQL Schema.sql
Created April 1, 2010 23:22
Twitter User Object MySQL Schema
CREATE TABLE `user` (
`twitter_id` int(10) unsigned NOT NULL,
`created_at` timestamp NOT NULL default '0000-00-00 00:00:00',
`name` varchar(80) NOT NULL,
`screen_name` varchar(30) NOT NULL,
`location` varchar(120) default NULL,
`description` varchar(640) default NULL,
`profile_image_url` varchar(400) NOT NULL,
`url` varchar(100) default NULL,
@thom-nic
thom-nic / NumberPickerPreference.java
Created May 6, 2011 22:06
NumberPicker Preference Dialog for Android!
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.TypedArray;
import android.preference.DialogPreference;
import android.util.AttributeSet;
import android.view.View;
import com.quietlycoding.android.picker.NumberPicker;
public class NumberPickerPreference extends DialogPreference {
@NTICompass
NTICompass / QRLogo.php
Created October 13, 2011 03:10
QR Code + Logo Generator
<?php
/**
* QR Code + Logo Generator
*
* http://labs.nticompassinc.com
*/
$data = isset($_GET['data']) ? $_GET['data'] : 'http://labs.nticompassinc.com';
$size = isset($_GET['size']) ? $_GET['size'] : '200x200';
$logo = isset($_GET['logo']) ? $_GET['logo'] : FALSE;
@alkos333
alkos333 / gist:1771618
Created February 8, 2012 17:52
Read URL GET variable
// Given a query string "?to=email&why=because&first=John&Last=smith"
// getUrlVar("to") will return "email"
// getUrlVar("last") will return "smith"
// Slightly more concise and improved version based on http://www.jquery4u.com/snippets/url-parameters-jquery/
function getUrlVar(key){
var result = new RegExp(key + "=([^&]*)", "i").exec(window.location.search);
return result && unescape(result[1]) || "";
}
@phoebebright
phoebebright / index.html
Created July 12, 2012 14:33
d3 rescale axis example
<html>
<head>
<title>D3 Axis Example</title>
<script src="http://d3js.org/d3.v2.js"></script>
</head>
<body>
<button id="rescale" onclick="rescale();">Rescale</button>
<script>
var width = 700,
@ducky427
ducky427 / viz.js
Last active September 16, 2023 08:15
d3.csv("data/gates_money.csv", function(data) {
custom_bubble_chart.init(data);
custom_bubble_chart.toggle_view('all');
});
$(document).ready(function() {
$('#view_selection a').click(function() {
var view_type = $(this).attr('id');
$('#view_selection a').removeClass('active');
$(this).toggleClass('active');
@bavington
bavington / outside-the-loop.php
Last active January 6, 2021 06:57
How to access the Loop and display your posts, from outside of Wordpress.
<ul>
<?php
require($_SERVER['DOCUMENT_ROOT'] . '/wordpress/wp-load.php');
$args = array(
// 'cat' => 3, // Only source posts from a specific category
'posts_per_page' => 2 // Specify how many posts you'd like to display
);
$latest_posts = new WP_Query( $args );
if ( $latest_posts->have_posts() ) {
while ( $latest_posts->have_posts() ) {
@mbmc
mbmc / Application.java
Last active November 25, 2019 14:36
Delete Parse duplicated Installation object for Android app
// Android app
private void setupParse(Context context) {
Parse.initialize(this, <PARSE_APP_ID>, <PARSE_CLIENT_KEY>);
ParseInstallation.getCurrentInstallation().put("uniqueId", getWifiMacAddress(context));
ParseInstallation.getCurrentInstallation().saveInBackground();
}
private String getWifiMacAddress(Context context) {
WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
if (wifiManager != null && wifiManager.getConnectionInfo() != null) {
@iturki
iturki / Configure.markdown
Last active August 29, 2015 14:08
How to Create a Wireless Hotspot in Windows 7

Step 1: Setting the wireless hotspot info:

Run cmd as Administrator and type the following:

> netsh wlan set hostednetwork mode=allow ssid=HotspotName key=HotspotPass keyUsage=persistent
HotspotName: The Hotspot SSID (Hotspot name)

HotspotPass: The Hotspot Password.

@iturki
iturki / mohammad-analysis.R
Last active April 1, 2016 22:04
Analysis of the different ways to write the name Mohammad. More info: http://turki.ws/?p=14
require(tm)
require(wordcloud )
require(descr)
fileName <- "data.txt"
conn <- file(fileName,open="r")
names <-readLines(conn)
List <- c()
for (i in 1:length(names)){
#remove commas from the fullname