Skip to content

Instantly share code, notes, and snippets.

View Twitter User Object MySQL Schema.sql
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
NumberPicker Preference Dialog for Android!
View NumberPickerPreference.java
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 Oct 13, 2011
QR Code + Logo Generator
View QRLogo.php
<?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 Feb 8, 2012
Read URL GET variable
View gist:1771618
// 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 Jul 12, 2012
d3 rescale axis example
View index.html
<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,
View viz.js
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 Jan 6, 2021
How to access the Loop and display your posts, from outside of Wordpress.
View outside-the-loop.php
<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 Nov 25, 2019
Delete Parse duplicated Installation object for Android app
View Application.java
// 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 Aug 29, 2015
How to Create a Wireless Hotspot in Windows 7
View Configure.markdown

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 Apr 1, 2016
Analysis of the different ways to write the name Mohammad. More info: http://turki.ws/?p=14
View mohammad-analysis.R
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