Skip to content

Instantly share code, notes, and snippets.

@stevenbeeckman
stevenbeeckman / gist:4526166
Last active December 11, 2015 01:49
An example of how to call a JSON webservice directly from BlackBerry 10 Cascades QML. This gist also shows how to convert Date strings purely in QML. This gist is part of this blogpost: http://www.shadowmedia.be/bbdevbe/2013/01/13/listing-json-data-from-a-webservice-using-pure-qml/.
import bb.cascades 1.0
import bb.data 1.0 // don't forget to add "LIBS += -lbbdata" to your .pro file!
Page {
id: pgDetail
actions: [
ActionItem {
title: qsTr("Refresh")
onTriggered: {
@mwunsch
mwunsch / emojiToImage.js
Created December 16, 2012 01:24
Replace emoji characters in a string with an image of said emoji.
// (c) 2012 Mark Wunsch http://markwunsch.com
// MIT license.
if (!String.fromCodePoint) {
/*!
* ES6 Unicode Shims 0.1
* (c) 2012 Steven Levithan <http://slevithan.com/>
* MIT License
*/
String.fromCodePoint = function fromCodePoint () {
@bbrewer97202
bbrewer97202 / css3pulsingcirle
Created September 18, 2012 18:06
Simple CSS3 pulsing circle animation
<html>
<head>
<title></title>
</head>
<body>
<div id="pulser">
<div class="pulse pulse1"></div>
<div class="pulse pulse2"></div>
<div class="pulse pulse3"></div>
(function($){
var insertAtCaret = function(value) {
if (document.selection) { // IE
this.focus();
sel = document.selection.createRange();
sel.text = value;
this.focus();
}
else if (this.selectionStart || this.selectionStart == '0') {
var startPos = this.selectionStart;
<style>.gist{color:#000;}.gist div{padding:0;margin:0;}.gist .gist-file{border:1px solid #dedede;font-family:Monaco,'Courier New','DejaVu Sans Mono','Bitstream Vera Sans Mono',monospace;margin-bottom:1em;}.gist .gist-file .gist-meta{overflow:hidden;font-size:85%;padding:.5em;color:#666;background-color:#eaeaea;}.gist .gist-file .gist-meta a{color:#369;}.gist .gist-file .gist-meta a:visited{color:#737;}.gist .gist-file .gist-data{overflow:auto;word-wrap:normal;background-color:#f8f8ff;border-bottom:1px solid #ddd;font-size:100%;}.gist .gist-file .gist-data pre{font-family:'Bitstream Vera Sans Mono','Courier',monospace;background:transparent !important;margin:0 !important;border:none !important;padding:.25em .5em .5em .5em !important;}.gist .gist-file .gist-data .gist-highlight{background:transparent !important;}.gist .gist-file .gist-data .gist-line-numbers{background-color:#ececec;color:#aaa;border-right:1px solid #ddd;text-align:right;}.gist .gist-file .gist-data .gist-line-numbers span{clear:right;display:b
@soemarko
soemarko / theme.html
Created November 26, 2011 16:18
embed github gist to tumblr
<!-- Add the following lines to theme's html code right before </head> -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script src="http://static.tumblr.com/fpifyru/VCxlv9xwi/writecapture.js"></script>
<script src="http://static.tumblr.com/fpifyru/AKFlv9zdu/embedgist.js"></script>
<!--
Usage: just add <div class="gist">[gist URL]</div>
Example: <div class="gist">https://gist.github.com/1395926</div>
-->
@potch
potch / gist_line_numbers.css
Created September 26, 2011 18:53
CSS to add line numbers to embedded gists
.gist-highlight {
border-left: 3ex solid #eee;
position: relative;
}
.gist-highlight pre {
counter-reset: linenumbers;
}
.gist-highlight pre div:before {
@xjamundx
xjamundx / canvas-upload.php
Created February 26, 2011 16:13
php canvas base64 png decoder
<?php
// requires php5
define('UPLOAD_DIR', 'images/');
$img = $_POST['img'];
$img = str_replace('data:image/png;base64,', '', $img);
$img = str_replace(' ', '+', $img);
$data = base64_decode($img);
$file = UPLOAD_DIR . uniqid() . '.png';
$success = file_put_contents($file, $data);