Skip to content

Instantly share code, notes, and snippets.

Moshe MosheBerman

Block or report user

Report or block MosheBerman

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
@MosheBerman
MosheBerman / gcoco.py
Last active Jan 10, 2019
Too many "pro" tier repos?
View gcoco.py
import requests
print "####################################"
print "# GitHub Collaborator Counter v1.0 #"
print "####################################"
access_token = None
if access_token is None:
View statusBarTint.swift
// Untested on iOS 11, untested with App Review. YMMV.
// MARK: - Theming the Status Bar
private func set(statusBar color: UIColor) {
guard let statusBarWindow = UIApplication.shared.value(forKey: "statusBarWindow") as? UIWindow else
{
print("Failed to get status bar window.")
return
}
View locator-encapsulate-this.js
function Locator(successCallback, errorCallback)
{
var _this = this;
this.success = function(location)
{
console.dir(location);
_this.pauseLocationUpdates();
successCallback(location);
@MosheBerman
MosheBerman / locator-arrow.js
Last active Jul 24, 2017
A JS object/function to locate a user with `navigator.geolocation`.
View locator-arrow.js
function Locator(successCallback, errorCallback)
{
this.success = (location) =>
{
console.dir(location);
this.pauseLocationUpdates();
successCallback(location);
};
@MosheBerman
MosheBerman / StatusBarHack.swift
Created Mar 20, 2017
Set the Status Bar Color on iOS...
View StatusBarHack.swift
func setStatusBarColor(color: UIColor) {
let statusBarWindow = UIApplication.sharedApplication().valueForKey("statusBarWindow")
let statusBar = statusBarWindow!.valueForKey("statusBar")
let selector = Selector("setForegroundColor:")
if statusBar!.respondsToSelector(selector) {
statusBar!.performSelector(selector, withObject: color)
}
}
@MosheBerman
MosheBerman / fcm_test_literature.py
Created Sep 21, 2016
A way to send the best and worst of classical literature over APNs.
View fcm_test_literature.py
import requests
import json
url = "https://fcm.googleapis.com/fcm/send"
project_key = "token"
def send(title, text):
headers = {
"Authorization": "key={}".format(project_key),
"Content-Type": "application/json"
@MosheBerman
MosheBerman / fcm_test.py
Created Sep 15, 2016
A testbed for Firebase Cloud Messaging.
View fcm_test.py
import requests
import json
url = "https://fcm.googleapis.com/fcm/send"
project_key = "firebase-dashboard-project-key"
headers = {
"Authorization": "key={}".format(project_key),
"Content-Type": "application/json"
}
@MosheBerman
MosheBerman / URLParser.js
Created Jul 18, 2016
A collection of JavaSscript functions to parse out URLs into distinct data points.
View URLParser.js
// URL Here:
var sampleURL = "http://domain.com/#order/food=chicken/drink=coke";
// Function to parse the URL
function parseURL(inputURL) {
/**
Strategy:
View OmerCode.swift
func textForToday() -> NSAttributedString
{
let sefira = Sefira()
let day = sefira.dayToUseForDisplay()
let prayers : KCSefiraPrayerAddition = self.flagsForPrayerComponentsEnabledByUser()
let storedCustom = SettingsManager.sharedManager.custom()
if let custom = KCSefiraCustom(rawValue: storedCustom) {
sefiraFormatter.custom = custom
}
View iTunes.sh
#!/bin/sh
#
####################################
# iTunes Command Line Control v1.0
# written by David Schlosnagle
# created 2001.11.08
####################################
showHelp () {
echo "-----------------------------";
You can’t perform that action at this time.