Skip to content

Instantly share code, notes, and snippets.

Thomas Clowes clowestab

Block or report user

Report or block clowestab

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@clowestab
clowestab / Instagram-ghost.js
Created Nov 10, 2018
A script for synchronising your Instagram posts with your Ghost blog as discussed on my blog (https://thomasclowes.com)
View Instagram-ghost.js
const Parser = require('rss-parser');
const request = require('request');
const fs = require('fs');
const mime = require('mime-types');
const slugify = require('slugify');
//Enter your ghost credentials here
const clientId = "ghost-frontend";
const clientSecret = "enter-your-secret";
const username = "enter-your-email";
View gist:83d5c9a501e2f1d712cfc14de484b7ab
0x8be65246
0000000000000000000000000000000000000000000000000000000000000123
0000000000000000000000000000000000000000000000000000000000000080
3132333435363738393000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000e0
0000000000000000000000000000000000000000000000000000000000000002
0000000000000000000000000000000000000000000000000000000000000456
0000000000000000000000000000000000000000000000000000000000000789
000000000000000000000000000000000000000000000000000000000000000d
48656c6c6f2c20776f726c642100000000000000000000000000000000000000
View making-an-overlay-2.java
final FrameLayout tabContent = (FrameLayout) view.findViewById(android.R.id.tabcontent);
View overlay = (View) view.findViewById(R.id.statusLayout);
overlay.setOnTouchListener(new View.OnTouchListener() {
private float mDownX;
private float mDownY;
private final float SCROLL_THRESHOLD = 10;
private boolean isOnClick;
View making-an-overlay.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
View revisiting-gulp-1.js
//Watches our .jsx files and our .js. If any change, it calls the build task.
const gulp = require('gulp');
const runSequence = require('run-sequence');
const gutil = require('gulp-util');
//Boolean to hold state of watch JSX watch task
let taskOngoing = false;
//This task simply sets the taskOngoing boolean to false
gulp.task('jsxdone', function(callback) {
View security-and-wallets-1.js
//Include and initialise web3
var Web3 = require("web3")
var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
//Output the current block number (to check things are working)
web3.eth.blockNumber
//Output a list of accounts. On a new Parity node this will be empty []
web3.eth.accounts
View writing-an-api-2.php
<?php
public function callOldVersion($argumentsList) {
//If they have requested a NON current API version
if (APIHelpers::$API_VERSION != APIHelpers::CURRENT_API_VERSION) {
//get the name of the method that they have called
$actionName = $this->dispatcher->getActionName();
View writing-an-api-1.php
<?php
public function __call($method, $arguments) {
$realMethodName = "_" . $method;
if (method_exists($this, $realMethodName)) {
$response = $this->callOldVersion($arguments);
View ios-push-notifications-1.swift
let types = UIUserNotificationSettings(forTypes: [UIUserNotificationType.Alert, UIUserNotificationType.Badge, UIUserNotificationType.Sound], categories: nil)
UIApplication.sharedApplication().registerUserNotificationSettings(types)
UIApplication.sharedApplication().registerForRemoteNotifications()
View when-to-layout-views.swift
//Load a nib with a given name
class func loadFromNibNamed(nibNamed: String, bundle : NSBundle = NSBundle.mainBundle()) -> UIView! {
return UINib(nibName: nibNamed, bundle: bundle).instantiateWithOwner(nil, options: nil)[0] as? UIView
}
You can’t perform that action at this time.