Skip to content

Instantly share code, notes, and snippets.

View kexoth's full-sized avatar

Aleksandar Kex Trpeski kexoth

View GitHub Profile
function solution(N, A) {
var counters = new Uint32Array(N),
max = 0,
gMax = 0;
for (i = 0; i < A.length; i++) {
var value = A[i];
<article class="socialmediaicons">
<span class="title"> Join the movement: </span>
<ul class="group">
<% appdata.social.forEach(function(item) { %>
<li>
<a href="<%= item.url %>">
<img class="icon" src="<%= item.imageURL %>" alt="icon for <%= item.shortname %>" />"
</a>
</li>
<% }); %>
GCClient *apiClient = [GCClient sharedClient];
[apiClient setAuthorizationHeaderWithToken:@"YOUR_TOKEN"];
[GCServiceAlbum getAlbumWithID:@(YOUR_ALBUM_ID) success:^(GCResponseStatus *responseStatus, GCAlbum *album) {
[album importAssetsFromURLs:@[@"YOUR_VIDEO_URL"] success:^(GCResponseStatus *responseStatus, NSArray *assets, GCPagination *pagination) {
/*
Imported the asset, do something.
*/
local muteButton=ui.newButton(muteGroup,"mute.png",display.contentWidth-50, display.contentHeight-430, 30, 30, function(event)
if clicked==event.action then
for i = 1, audio.totalChannels, 1 do
print("Volume:" .. audio.getVolume({ channel = i }) .. " Channel:" .. i)
if audio.getVolume({ channel = i }) == 0 then
audio.setVolume(1, { channel = i })
@kexoth
kexoth / CounLinesOfCode.hs
Last active August 29, 2015 14:02
Started this gist as comparison implementation between scripts for counting number of files & lines of code in projects in Swift (me) & Lua(@nikolamin). Added Python (@whoeverest) & Haskell (@bor0).
import System.Directory
import Control.Monad (filterM, mapM, liftM)
import System.FilePath ((</>))
getDirsRec :: FilePath -> IO [FilePath]
getDirsRec d = do
dirContents <- getDirectoryContents d
let dirContents' = [ d </> x | x <- dirContents, x /= ".", x /= ".." ]
dirs' <- mapM dirRec dirContents'
return (concat dirs' ++ [d])
@kexoth
kexoth / AESCrypt.js
Created March 20, 2014 00:04
AES 128 Encryption/Decription with CBC, PKCS7 Padding & Base64 Encoding/Decoding.
var http = require('http');
var url = require('url');
var crypto = require('crypto');
var AESCrypt = {};
AESCrypt.decrypt = function(cryptkey, iv, encryptdata) {
encryptdata = new Buffer(encryptdata, 'base64').toString('binary');
var decipher = crypto.createDecipheriv('aes-128-cbc', cryptkey, iv),
decoded = decipher.update(encryptdata, 'binary', 'utf8');
@kexoth
kexoth / gist:9646192
Last active August 29, 2015 13:57 — forked from ericchen/gist:3081970
var crypto = require('crypto');
var AESCrypt = {};
AESCrypt.decrypt = function(cryptkey, iv, encryptdata) {
encryptdata = new Buffer(encryptdata, 'base64').toString('binary');
var decipher = crypto.createDecipheriv('aes-128-cbc', cryptkey, iv),
decoded = decipher.update(encryptdata);
var http = require('http');
var url = require('url');
var activeState = "0";
var reqCounter = 0;
var server = http.createServer(function (req, res) {
console.log("____________________________");
console.log("URL:", decodeURIComponent(req.url));
@interface NSManagedObject (Serialization)
- (NSDictionary*) toDictionary;
- (void) populateFromDictionary:(NSDictionary*)dict;
+ (NSManagedObject*) createManagedObjectFromDictionary:(NSDictionary*)dict
inContext:(NSManagedObjectContext*)context;
@end
@kexoth
kexoth / iStyle.js
Last active December 30, 2015 02:29
var node_io = require("node.io");
function methods(input){
var _methods = {
input:input,
run: function(url) {
this.getHtml(url, function(err, $) {
var items = [];
$('li.item').each(function (li){